# what the mechanics behind this ?

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

## Recommended Posts

Hello Guys ,

I am developing a running game in which player jump overs the obstacles . I am confused how to make conditions for jumping . So , that if  player did anything wrong , player collides with the obstacles .  in starting , first i get  the horizontal distance which is to be covered and using this and current speed calculate the time required and using this time calculates the jump required . But , in this situation. Player  covers all the obstacles without any difficulty . So , i change my approach and instead of time i use height required to jump over obstacle .  In the later approach there is no speed involve and player is doing mistakes if player jump after certain point .

But , i want to know how mechanics work in these running and jumping game  ? Some tutorial or advice . I will be very thankful to you .

##### Share on other sites

I would have solved this problem with simple classic physics. Look at your problem as a composite system. Your character got a force which makes it move. Futhermore the character would have a force, which makes it jump. It may also have a drag force, and lastly a gravity force.

By using D'Alembert's principle, you would calculate the final force, which is acting on the object. It implies that, if we have a set of forces acting on an object, we can replace all those forces with a single force, which is done by just summing the forces together.

So I would have calculated the forces, the acceleration, the velocity and the position of you character, by using vector math. Then i would just do a simple bounding box test between the character and the obstacle, to check if the character is inside.

Here is a link for a simple tutorial, which explains what i have mentioned.
http://ianqvist.blogspot.no/2009/09/2d-physics-engine-tutorial-part-3.html

Edited by Tapped

##### Share on other sites

In addition to what was said above, you could look into thinking about a double-tap jump being higher than a single tap for example. It will help to simplify the mechanic.

##### Share on other sites
&nbsp;

Hello Guys ,&nbsp;
&nbsp;
I am developing a running game in which player jump overs the obstacles

&nbsp;
Timing jumps accurately is the main point of such a platform game: you should definitely let the player jump at any time and place, allowing any mistake and simulating crashing into obstacles, falling into pits etc. in the most predictable ways.
Note that a physically correct simulation can be reduced to a fixed animation sequence (or a fixed animation sequence for each state, presumably the combinations of a few horizontal speeds and a few platform slopes plus special cases like jumping from vertical walls).

##### Share on other sites

Thanks guys . Your collective info. solves my problem .

1. 1
2. 2
3. 3
Rutin
22
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 10
• ### Forum Statistics

• Total Topics
633652
• Total Posts
3013138
×