public void restart() { currentState = GameState.READY; guy.restart(); scrollHandler.restart(); for (int i = 0; i < enemyList.size(); i++) { enemyList.get(i).restart(); } for (int i = 0; i < tileList.size(); i++) { tileList.get(i).restart(); } }
public void updateRunning(float delta) { guy.update(delta); for (int i = 0; i < enemyList.size(); i++) { enemyList.get(i).update(delta, gameWidth); } for (int i = 0; i < tileList.size(); i++) { tileList.get(i).update(delta); } scrollHandler.update(delta); checkIfGameWon(); checkIfAlive(); handleCollisions(); }
private void checkIfAlive() { if (!getGuy().isAlive()) { scrollHandler.stop(); currentState = GameState.GAMEOVER; } }
public void start() { currentState = GameState.RUNNING; scrollHandler.start(); }
private void checkIfGameWon() { if (getGuy().isGameWon()) { scrollHandler.stop(); currentState = GameState.WINNER; } }