Hey guys,
I want to roll a simple platformer with some physics elements in Slick, and I've been trying to set up Fizzy. I'm having some weird trouble with gravity, though. When I launch, my player sprite drops to the nearest solid surface, as expected. But when I move him upward (using applyForce) he'll just hang in the air until I either push him left, right, or down. As soon as I do, gravity seems to work on him again. This is my movement code, from my update method...
Code:
if (gc.getInput().isKeyDown(Input.KEY_LEFT)) {playerBody.applyForce(-0.01f, 0f);}
if (gc.getInput().isKeyDown(Input.KEY_RIGHT)) {playerBody.applyForce(0.01f, 0f);}
if (gc.getInput().isKeyDown(Input.KEY_UP)) {playerBody.applyForce(0f, -0.06f);}
if (gc.getInput().isKeyDown(Input.KEY_DOWN)) {playerBody.applyForce(0f, 0.01f);}
...
mapWorld.update(delta);
playerBody is a Rectangular DynamicBody, and gravity is set to 0.0001f -- I'm working at a really small scale right now, and when it actually acts on the player, that amount of gravity is more than enough. Any ideas what I'm doing wrong? Thanks in advance for any suggestions!
Edit: Want to apologize for the double-post. This was my first post to these forums and I managed to forget that I'd already made a submission and it got caught in the new-user filter.