Left/bottom bounds, and move a tile at a time rather than with a pointless cursor.

This commit is contained in:
stevenhowes
2021-04-08 19:50:35 +01:00
parent 16cbc5ca61
commit 8fdce7ba4b
4 changed files with 42 additions and 16 deletions
Binary file not shown.
BIN
View File
Binary file not shown.
+34 -8
View File
@@ -129,44 +129,70 @@ void game2_tick_input()
// Up arrow // Up arrow
if(input_readkey(57)) if(input_readkey(57))
{ {
TilePlayer.location.Y += 6 * (tick - lasttick); if(tick > readmodkey)
{
TilePlayer.location.Y += 100;
if(TilePlayer.location.Y > (950)) if(TilePlayer.location.Y > (950))
{ {
TilePlayer.location.Y = 100; TilePlayer.location.Y = 50;
TilePlayer.mapoffset.Y += 10; TilePlayer.mapoffset.Y += 10;
} }
readmodkey = tick + 10;
}
} }
// Down arrow // Down arrow
if(input_readkey(41)) if(input_readkey(41))
{ {
TilePlayer.location.Y -= 6 * (tick - lasttick); if(tick > readmodkey)
{
TilePlayer.location.Y -= 100;
if(TilePlayer.location.Y < (10)) if(TilePlayer.location.Y < (10))
{ {
TilePlayer.location.Y = 900; if(TilePlayer.mapoffset.Y > 0)
{
TilePlayer.location.Y = 950;
TilePlayer.mapoffset.Y -= 10; TilePlayer.mapoffset.Y -= 10;
}else{
TilePlayer.location.Y += 100;
}
}
readmodkey = tick + 10;
} }
} }
// Right arrow // Right arrow
if(input_readkey(121)) if(input_readkey(121))
{ {
TilePlayer.location.X += 6 * (tick - lasttick); if(tick > readmodkey)
{
TilePlayer.location.X += 100;
if(TilePlayer.location.X > (950)) if(TilePlayer.location.X > (950))
{ {
TilePlayer.location.X = 100; TilePlayer.location.X = 50;
TilePlayer.mapoffset.X += 10; TilePlayer.mapoffset.X += 10;
} }
readmodkey = tick + 10;
}
} }
// Left arrow // Left arrow
if(input_readkey(25)) if(input_readkey(25))
{ {
TilePlayer.location.X -= 6 * (tick - lasttick); if(tick > readmodkey)
{
TilePlayer.location.X -= 100;
if(TilePlayer.location.X < (10)) if(TilePlayer.location.X < (10))
{ {
TilePlayer.location.X = 900; if(TilePlayer.mapoffset.X > 0)
{
TilePlayer.location.X = 950;
TilePlayer.mapoffset.X -= 10; TilePlayer.mapoffset.X -= 10;
}else{
TilePlayer.location.X += 100;
}
}
readmodkey = tick + 10;
} }
} }
Binary file not shown.