• ### What is your GameDev Story?

#### Archived

This topic is now archived and is closed to further replies.

# problem with jump'n'run physics

This topic is 5840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

hi! I have a problem with my jump''n''run game. When the player jumps it looks ok, but when he walks off a platform he''s falling too fast. When I set my numbers to smaller values, the player falls from a platform with a "normal" speed, but when he jumps he is slow like a feather. What is the problem? I do this basic calculations in the game: every frame: velY += gravity; when hitting a floor: velY = gravity; (velY is gravity as long as the player stands on something) when jumping velY -= 8 bye chris

##### Share on other sites
I assume VelY is the vertical velocity.

Since when you''re standing on something, VelY = 0 ( or else you''re going through the floor) this means Gravity = 0... That looks quite like a problem.

Do you mean by "when jumping" that you set the VelY to -8 when the jump starts? Or that you set it to -8 as long as the jump key is pressed?

Could you please post pseudo-code of what you do :

- Each frame
- When the jump command key is pressed

ToohrVyk
-------------
Extatica - a free 3d game engine
Available soon!

##### Share on other sites
hi, I found the mistake :-) I forgot to multiply my "jump power" (the vertical velocity) with the frametime.

bye
chris

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634058
• Total Posts
3015289
×