Exemplo n.º 1
0
  /** The act method is called by the GameScreen to perform the action in the ScreenState. */
  public void act() {
    // handle key events
    String key = Greenfoot.getKey();
    if (key != null) {
      handleKeyPress(key);
    }

    // handle mouse events
    if (startGameButton.wasClicked()) {
      handleStartGame();
    }

    if (highscoreButton != null && highscoreButton.wasClicked()) {
      // Set the new screen state
      gameScreen.setState(gameScreen.getHighscoreState());
    }
  }