Fixed a glitch and modified elevator speed

The on ground state is now only refreshed when the player isn't raising, 
holding the jump button doesn't cancel the on_ground buffer anymore.
Elevator substract twice GRAV now.
This commit is contained in:
KikooDX 2020-02-13 13:46:28 +01:00
parent 51044af762
commit 85564f45d0
2 changed files with 2 additions and 3 deletions

Binary file not shown.

View File

@ -69,12 +69,11 @@ int main(void)
player_x += hspd;
}
//ground detection
if (collide_solid(player_x, player_y + 1, level)) on_ground = 6;
if (vspd >= 0 && collide_solid(player_x, player_y + 1, level)) on_ground = 6;
else
{
if (vspd > MIN_VSPD) vspd += GRAV;
if (jump_hold)
if (on_ground) on_ground--;
if (on_ground) on_ground--;
}
//vertical movement
if (UG_CAN_JUMP) jump_test(&jump_pressed, &jump_buffer, &jump_hold);