Jump to content
  • Advertisement
Sign in to follow this  
thenewBoy

what the mechanics behind this ?

This topic is 1938 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

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 this post


Link to post
Share on other sites
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

Edited by Tapped

Share this post


Link to post
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 this post


Link to post
Share on other sites
 

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

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!