Mario Style Jumping


(noobIndie) #1

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


(Zachary Lewis) #2

(Jacob Albano) #3

Have you tested it yourself? I don’t mean to answer every one of your questions this way, but if you always run your ideas by people first you’ll never get anything done. Try to implement it first, and if it doesn’t work after some testing, feel free to get feedback on your approach.