what the mechanics behind this ?

Started by
3 comments, last by thenewBoy 10 years, 10 months ago

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 .

Advertisement

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

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.

 

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

 
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).

Omae Wa Mou Shindeiru

Thanks guys . Your collective info. solves my problem . rolleyes.gif biggrin.png

This topic is closed to new replies.

Advertisement