public void handleInput() { InputHandler input = Game.getInstance().getInputHandler(); if (input.isSpacePressed()) { // If previous state complete if (state.isComplete()) { // Jump again state = new PlayerJumping(this); } } // if not running and previous state complete, run again else if (!(state instanceof PlayerRunning) && state.isComplete()) state = new PlayerRunning(this); }
@Override public void update(long elapsedTime) { Game.getInstance().endGame(); }