• Advertisement
Sign in to follow this  

jump and confusion

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

II am completely confused about having an object jump in the air and fall back down on same spot. THis runs at 30 times a second and to make the object jump a decent jump I need to make initial speed high as it is a computer game. _YStartVel = 40 _jumpFrame += 0.33 _y = _y + Round((_YStartVel - (9.8 * _jumpFrame))) It jumps up and falls back down ok but if I jump from a ledge I come back down too fast and I cant detect the object underneath to see if it lands. What is a better way to go so each time I display the image it will not move too far (more than 64 which is tile size I need to check) and still look real.

Share this post


Link to post
Share on other sites
Advertisement
Store the value of _YStartVel - (9.8 * _jumpFrame) in a local variable. If it gets below a certain threshold (called terminal velocity), clamp it. Then proceed.

On a sidenote, the constant 9.8 seems to imply that 1 pixel equals 1 meter in your game... is that what you want? Maybe you should set it to 0.1 or some other value that gives better results.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement