Jump to content
  • Advertisement
Sign in to follow this  
TAXfromDENMARK

2D platform game with 2 types of constraints

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

I am developing a 2D platform game, and I seem to have run into a problem. The first part of the game is classic platform movement where the hero can jump and move around the platforms. I use the verlet method, to update every timeframe. (nowPos=2*nowPos-oldPos+accel*timestep*timestep) Collisions with the platforms are handled in both directions by moving the hero the shortest way out of collision in the opposite direction of the hero velocity. If no way out is found within reasonable distance I just step back, (NewPos = oldPos) and the hero is out of collision. This works, but it gets more complicated. The hero is supposed to fire an arrow out in the scene (instantanious) and swing along a string attached to the arrow. I did the string in an isolated demo by moving the hero position towards the anchorpoint of the string. This works seperatly, but I seem to run into trouble, when I want to handle the string concurrently with the platform collision. I guess my first attempt tomorrow will be to keep the string constraint using forces instead of the brute adjustment. Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
Which kind of ninja rope do you want?
For a classic "rubber band" you can simply add a scaled version of the vector between the player and the anchor point to the player's acceleration.
Gravity should take care of the rest..

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!