Example #1
0
  public void updateRunning(float delta) {
    ship.update(delta);
    scrollHandler.update(delta);

    if (scrollHandler.collides(ship) || ship.outOfBounds()) {
      scrollHandler.stop();
      AssetLoader.stopAccelerateSound();
      AssetLoader.playExplosion();
      currentState = GameState.GAMEOVER;
    }
  }
Example #2
0
  public void restart() {

    try {
      Thread.sleep(500);
    } catch (InterruptedException ex) {
      Thread.currentThread().interrupt();
    }

    currentState = GameState.READY;
    score = 0;
    scrollHandler.onRestart();
    ship.onRestart();
    currentState = GameState.READY;
  }