Platform game jump

ok. I am making a mario game in which you jump to platforms. I dont get the gravity code for the jumping and for landing oni the platforms. any help would be appreciated. <:}

THE gravity code? Does that mean you are working off of something now? Whatcha got?

Well… There are a number of ways you can handle this…

For one thing… The platform landing code (when you hit a platform and the guy stops)… Will need to be intact or else the character will fall through…

Basically set it up like this…

ySpeed;
gravity;

These are your two new variables… With these… it’ll tell you what your ySpeed of your character (or how he rises or falls) and what rate it’ll be. The gravity is how fast the character will fall then…

Well Here is your basic algorithm then… Reminder… This is not real code… Just an algorithm that can be transferred to code…



if(character is not on platform)
{
   ySpeed -= gravity;
   character._y += ySpeed;
}
if(character pressed jump key)
{
   ySpeed = 6;
}


These statements should then be looped around in a fashion that everytime the character player is above any platform or in “jumping mode”… That it will rise sharply… And then fall…

I’d suggest putting the gravity around .5 - 1

http://w1.910.telia.com/~u91024173/tut_12/ <<<<< tutorial

it may be to some help