Sign in to follow this  

2D platform game with 2 types of constraints

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

This topic is 4399 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this