I am implementing mario style jumping and was wondering if this is the right approach to do it. Here’s the algo
if(isBtnJump){
ySpeed +=jumpStep; if(ySpeed > MAX_JUMP_SPEED){
isBtnJump = false;
}
}else{
ySpeed -=gravity;
}
One question, is it fine to apply gravity only when the player is not jumping? and how can i make it frame rate independent?
EDITED