Late Button Press Tolerance in Jumping

M

MechTurtle

Guest
A lot of game design articles read that jumping in games should be more forgiving to the player. So when a player goes to jump off of a ledge, even if they fall off the edge, they should have a small window where their jump can be registered in game.

Does anyone know how this is done with code?
 

wamingo

Member
maybe something like this
Code:
if(not grounded && not jumping){
  jumptolerancetimer++;
  if(press space && jumptolerancetimer < 5){
  // jump
  }
}else{
  jumptolerancetimer=0;
}
 

TheouAegis

Member
I actually disagree, but you don't want poor mechanics like in Bethesda's Fallout games. I think usually it feels unforgiving because the rest of the mechanics are badly programmed, not the jumping.

That said, some games do incorporate start_of_fall and/or start_of_jump states to give 1 frame of leeway.
 
Top