Sign in to follow this  
jdindia

Looking for tips on 2d platformer physics

Recommended Posts

jdindia    259
I'm writing a 2d platform game using Box2d. So far I'm just modeling the character as a box (with a sprite pasted on) and applying forces to move around. It's uhm.. interesting. The basic movement is no problem, but wow does the box flip and roll every which way. Preventing Mario from falling on his face or running while laying on his face isn't so easy. >_< It's clear I can do a bit of tweaking, but I imagine others must have come across these problems before. It would be nice to save myself from completely reinventing the wheel.

Share this post


Link to post
Share on other sites
Treb    172
I'm not familiar with Box2D, but most 2D platformers would not even implement rotation of their characters since Mario goes through the entire game standing straight up.

Share this post


Link to post
Share on other sites
jdindia    259
Hrmm. I considered forcing him permanently up-right. Certainly the original platformers like Mario Bros. didn't rotate, but they also didn't have a really great physics engine under the hood.

Eventually I'd like to have dangling ropes and big wheels that turn and you can grab onto. It seems like being able to handle rotation would make a lot of that sort of thing easier. If I can solve some of these control problems, I think I get a lot more flexibility in possible physics interactions.

Share this post


Link to post
Share on other sites
OrangyTang    1298
You'd probably be better off simulating the player as a point (or possibly a circle). Eliminate rotation from the physics simulation but instead orientate the character based on the surface normal of whatever he's standing on.

Certain aspects will have to take into account the surface normal (jumping for example should apply the jump force along the normal, and friction will probably need to take it into account too).

Share this post


Link to post
Share on other sites

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