Jumping?

Started by
23 comments, last by grhodes_at_work 19 years, 8 months ago
Quote:Original post by K88soft
Ok thank you now how long will I be at 982?
that bites!


i have no idea what this means. what's 982?

-me
Advertisement
my rating see it.
It's like I'm dumber than a monkey on dope!
Eat food and life is yours!
Here is the easy way to make a character jump.

Keep track of a jump velocity.

Whenever the player jumpes, set jump velocity to some number (whatever number will look good in your game). This determines how much force the player jumps off the ground with.

As your character is jumping, between each frame, decrease jump velocity by another number-- the higher this other number, the lower your character will be able to jump. This other number will be like gravity.

i.e.
jumpVelocity = 20;while ( playingGame){   playerY += jumpVelocity;   jumpVelocity -= 2   if ( playerHitsThefloor)        jumpV = 0;}


You can make this more complicated, by keeping track of gravity and the players jumping power separately, or doing other nifty things, but essentially you just need to make the player go up and come back down again. :)


i.e.
  playerY += jumpVelocity;  playerY -= gravity;   jumpVelocity = jumpVelocity / 2;


It's all about what looks good, unless you're doing a simulation of some sort of course.

Best of luck,
Will
------------------http://www.nentari.com
WOW thats cool I can't wait to try it out.

P.S.
What the heck, 961! I didn't do anything should I talk to a mod about this?

Eat food and life is yours!
I'm closing this thread since the original poster didn't seem to be too serious.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement