Skip to content

Instantly share code, notes, and snippets.

@jaymefosa
Created January 23, 2016 05:06
public boolean keyUp(int keycode) {
if ((keycode == Input.Keys.RIGHT || keycode == Input.Keys.LEFT) && player.currentAction == null) {
//Gdx.app.log("lkey up","");
player.currentState = Sarah.State.STANDING;
player.b2body.setLinearVelocity(0f, 0f);
}
return false;
}
---------------------
if (!Gdx.input.isKeyPressed(Input.Keys.UP)
&& !Gdx.input.isKeyPressed(Input.Keys.LEFT)
&& !Gdx.input.isKeyPressed(Input.Keys.RIGHT)
&& player.currentAction == null
&& player.currentState != Sarah.State.JUMPING
&& player.currentState != Sarah.State.FALLING
&& player.currentState != Sarah.State.STANDING
&& player.currentState != Sarah.State.RUNNING
)
{
player.b2body.setLinearVelocity(0f, 0f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment