I'm entering Android game development, and I already have a computer version of a game I want to publish. The thing is, I want to make this as good as it can be. With that said, I need a physics engine, really to only do one thing: make a parabolic movement of my main character as he's jumping in the air. Currently, my computer version simply makes the guy move up at a 45 degree angle, and as soon as it hits the ceiling, down at a 45 degree angle. I need a physics engine/library that would accomplish that, it has to be in java since that's my best language, it has to be 2D, and it has to be able to work on Android. Which physics engine/library could accomplish all of that?
|
|
You don't need a physics engine for this because the calculations required are extremely simple! All you have to do is to apply some gravity to your player's vertical velocity, and he will automatically follow an arc when jumping. For a detailed explanation of how it works, including a demo that runs in the browser, read the following answer: http://gamedev.stackexchange.com/a/29618/11686 But I'll transcribe the two most important points to this answer. This is all the physics you need to add to your game:
And this is how you initiate a jump, i.e. apply a vertical impulse to the player to get him off the floor, and let gravity take care of bringing him down:
|
|||
|
|
|
I would start by looking at libgdx. There are three main advantages for you as I see it:
The project is in active development, so some of the documentation is out of date. I would recommend starting with these tutorials on Scene2d to get started. There's like 10 or more sections, but you probably only need the first few: http://steigert.blogspot.com/2012/02/1-libgdx-tutorial-introduction.html |
|||
|
|
|
If you know Box2D, a 2D physics engine written in C++, then you know the Java version of that engine, JBox2D. There is an Android project based on JBox2D, I'd suggest you to take a look at it. http://code.google.com/p/androidbox2d/ |
|||||||
|