mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Split out tap_left and tap_right from player input loop
The game will freeze the player immediately if they release a directional button within 3 frames of pressing it. Similar to flipping, this involves global state, and will only apply to the first player entity.
This commit is contained in:
parent
1eb8570329
commit
cd4ce05cb3
1 changed files with 43 additions and 32 deletions
|
@ -2168,6 +2168,19 @@ void gameinput(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(game.press_left)
|
||||
{
|
||||
obj.entities[ie].ax = -3;
|
||||
obj.entities[ie].dir = 0;
|
||||
}
|
||||
else if (game.press_right)
|
||||
{
|
||||
obj.entities[ie].ax = 3;
|
||||
obj.entities[ie].dir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (game.press_left)
|
||||
{
|
||||
game.tapleft++;
|
||||
|
@ -2175,12 +2188,18 @@ void gameinput(void)
|
|||
else
|
||||
{
|
||||
if (game.tapleft <= 4 && game.tapleft > 0)
|
||||
{
|
||||
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
|
||||
{
|
||||
if (obj.entities[ie].rule == 0)
|
||||
{
|
||||
if (obj.entities[ie].vx < 0.0f)
|
||||
{
|
||||
obj.entities[ie].vx = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
game.tapleft = 0;
|
||||
}
|
||||
if (game.press_right)
|
||||
|
@ -2190,29 +2209,21 @@ void gameinput(void)
|
|||
else
|
||||
{
|
||||
if (game.tapright <= 4 && game.tapright > 0)
|
||||
{
|
||||
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
|
||||
{
|
||||
if (obj.entities[ie].rule == 0)
|
||||
{
|
||||
if (obj.entities[ie].vx > 0.0f)
|
||||
{
|
||||
obj.entities[ie].vx = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
game.tapright = 0;
|
||||
}
|
||||
|
||||
|
||||
if(game.press_left)
|
||||
{
|
||||
obj.entities[ie].ax = -3;
|
||||
obj.entities[ie].dir = 0;
|
||||
}
|
||||
else if (game.press_right)
|
||||
{
|
||||
obj.entities[ie].ax = 3;
|
||||
obj.entities[ie].dir = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!game.press_action)
|
||||
{
|
||||
game.jumppressed = 0;
|
||||
|
|
Loading…
Reference in a new issue