Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
It doesn't sound like you need a physics engine at all. Just use code to move the character up diagonally, detect when its BB hits the ceiling, and then start moving the character down diagonally. However, I think this question may be off topic per the FAQ. See the section about "which technology to use." –  Wackidev Jun 15 '12 at 22:33
I said in the question that I wanted a parabolic movement, not for it to move diagonally –  kullalok Jun 15 '12 at 22:38
After rereading the question, I see you did indeed. If I were you, I would take out the part about "my computer version", as it is confusing. However, I stand by my statement that you don't need a physics engine: some simple algebra will allow you to move in a parabola, probably more easily than if you got an engine involved. –  Wackidev Jun 15 '12 at 22:54
Thank you for your input. I did, originally, not intend to use any game engine at all. I assumed that I would need a game engine, but in light of this new information, I might reconsider. –  kullalok Jun 15 '12 at 22:57
That really doesn't need a physics engine, just some basic math, if even that. IF the character moves forward at a constant pace, and then upwards in a decreasing pace (a simple velocity curve) - it would look like a parabola right there. –  Oskar Duveborn Jun 16 '12 at 8:52
show 2 more comments

3 Answers

up vote 10 down vote accepted

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:


But I'll transcribe the two most important points to this answer. This is all the physics you need to add to your game:

float positionX, positionY;     // Position of the character
float velocityX, velocityY;     // Velocity of the character
float gravity = 0.5f;           // How strong is gravity

void Update(float time)
    velocityY += gravity * time;        // Apply gravity to vertical velocity
    positionX += velocityX * time;      // Apply horizontal velocity to X position
    positionY += velocityY * time;      // Apply vertical velocity to X position

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:

void OnJumpKeyPressed()
    velocityY = -12.0f;   // Give a vertical boost to the players velocity to start jump
share|improve this answer
+1 A physics engine for a parabolic jump is way overkill. –  Laurent Couvidou Jun 17 '12 at 16:07
add comment

I would start by looking at libgdx. There are three main advantages for you as I see it:

  1. It comes with Box2d integrated
  2. It comes with a 2D scene graph (in case you've never used a scene graph, this can greatly simplify setting up 2D levels and sprites, handling input, etc)
  3. It runs on the desktop and Android. In Eclipse, it's just a matter of selecting a project and pressing 'Run', and this is a tremendous boost over waiting for the emulator.

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:


share|improve this answer
add comment

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/

share|improve this answer
I've heard about it, but I've also heard that it does not function well. I also heard that libgdx is good. Do you know anything about that? –  kullalok Jun 15 '12 at 22:38
That might come in handy too, however I haven't used it; and I found JBox2D's abstraction quite well. You might want to take a look at their APIs to have a clearer idea which one would take less time to implement into the project. –  Tanshaydar Jun 15 '12 at 22:42
I've used c++ versions of Box2D in some of my projects, it works great. Though I don't know about libgdx. –  proGamer Jun 16 '12 at 18:46
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.