mirror of
https://github.com/stevenhowes/CTheEscape.git
synced 2026-05-26 15:53:29 +01:00
Movement fixes
This commit is contained in:
Binary file not shown.
+13
-11
@@ -311,14 +311,15 @@ int game2_check_collide()
|
|||||||
|
|
||||||
void game2_tick_input()
|
void game2_tick_input()
|
||||||
{
|
{
|
||||||
|
char movedy = 0;
|
||||||
|
|
||||||
// Store in case we have a vertical collide
|
// Store in case we have a vertical collide
|
||||||
TilePlayer.lastlocation.X = TilePlayer.location.X;
|
TilePlayer.lastlocation.X = TilePlayer.location.X;
|
||||||
TilePlayer.lastlocation.Y = TilePlayer.location.Y;
|
TilePlayer.lastlocation.Y = TilePlayer.location.Y;
|
||||||
TilePlayer.lastmapoffset.X = TilePlayer.mapoffset.X;
|
TilePlayer.lastmapoffset.X = TilePlayer.mapoffset.X;
|
||||||
TilePlayer.lastmapoffset.Y = TilePlayer.mapoffset.Y;
|
TilePlayer.lastmapoffset.Y = TilePlayer.mapoffset.Y;
|
||||||
|
|
||||||
// Up arrow
|
if(input_readkey(57))// Up arrow
|
||||||
if(input_readkey(57))
|
|
||||||
{
|
{
|
||||||
TilePlayer.location.Y += 3 * (tick - lasttick);
|
TilePlayer.location.Y += 3 * (tick - lasttick);
|
||||||
if(TilePlayer.location.Y > (910))
|
if(TilePlayer.location.Y > (910))
|
||||||
@@ -327,10 +328,9 @@ void game2_tick_input()
|
|||||||
TilePlayer.mapoffset.Y += 10;
|
TilePlayer.mapoffset.Y += 10;
|
||||||
game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y);
|
game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y);
|
||||||
}
|
}
|
||||||
|
movedy = 1;
|
||||||
}
|
}
|
||||||
|
else if(input_readkey(41))// Down arrow
|
||||||
// Down arrow
|
|
||||||
if(input_readkey(41))
|
|
||||||
{
|
{
|
||||||
TilePlayer.location.Y -= 3 * (tick - lasttick);
|
TilePlayer.location.Y -= 3 * (tick - lasttick);
|
||||||
if(TilePlayer.location.Y < (10))
|
if(TilePlayer.location.Y < (10))
|
||||||
@@ -344,6 +344,7 @@ void game2_tick_input()
|
|||||||
TilePlayer.location.Y = TilePlayer.lastlocation.Y;
|
TilePlayer.location.Y = TilePlayer.lastlocation.Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
movedy = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -355,12 +356,15 @@ void game2_tick_input()
|
|||||||
TilePlayer.mapoffset.Y = TilePlayer.lastmapoffset.Y;
|
TilePlayer.mapoffset.Y = TilePlayer.lastmapoffset.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dont allow horizontal and vertical - makes movement sketchy
|
||||||
|
if(movedy == 1)
|
||||||
|
return;
|
||||||
|
|
||||||
// Store in case we have a horizontal collide
|
// Store in case we have a horizontal collide
|
||||||
TilePlayer.lastlocation.X = TilePlayer.location.X;
|
TilePlayer.lastlocation.X = TilePlayer.location.X;
|
||||||
TilePlayer.lastlocation.Y = TilePlayer.location.Y;
|
TilePlayer.lastlocation.Y = TilePlayer.location.Y;
|
||||||
|
|
||||||
// Right arrow
|
if(input_readkey(121))// Right arrow
|
||||||
if(input_readkey(121))
|
|
||||||
{
|
{
|
||||||
TilePlayer.location.X += 3 * (tick - lasttick);
|
TilePlayer.location.X += 3 * (tick - lasttick);
|
||||||
if(TilePlayer.location.X > (910))
|
if(TilePlayer.location.X > (910))
|
||||||
@@ -370,9 +374,7 @@ void game2_tick_input()
|
|||||||
game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y);
|
game2_fillmap(TilePlayer.mapoffset.X,TilePlayer.mapoffset.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(input_readkey(25))// Left arrow
|
||||||
// Left arrow
|
|
||||||
if(input_readkey(25))
|
|
||||||
{
|
{
|
||||||
TilePlayer.location.X -= 3 * (tick - lasttick);
|
TilePlayer.location.X -= 3 * (tick - lasttick);
|
||||||
if(TilePlayer.location.X < (10))
|
if(TilePlayer.location.X < (10))
|
||||||
|
|||||||
Reference in New Issue
Block a user