Пример #1
0
  public void pauseClick(View v) {

    if (gameEngine != null && gameEngine.hasBeenInitialized()) {
      if (gameEventManager.getGameState() == GAME_STATE.PLAYING) {
        Log.d(TAG, "un pausing Game");
        pauseButton.setText("Resume");
        gameEventManager.pauseGame();
      } else if (gameEventManager.getGameState() == GAME_STATE.PAUSED) {
        Log.d(TAG, "Pausing Game");
        pauseButton.setText("Pause");
        gameEventManager.unPauseGame();
      }
    }
  }
Пример #2
0
  private void initializeGame() {

    if (gameEngine == null) {
      Log.d(TAG, "Attempting to Load Level");
      gameEventManager = new GameEventManager();
      gameEventManager.addObserver(this);

      gameEngine =
          new GameEngine(drawingView.getWidth(), drawingView.getHeight(), gameEventManager);

      gameEngine.loadLevel(getResources().openRawResource(levelResourceId));

      drawGameRate = gameEngine.getLevelConfig().getDrawScreenRate();
      drawingView.intializeDrawView(gameEngine, gameEventManager);

      titleText = gameEngine.getLevelConfig().getLevelTitle() + " - Points: ";
      titleView.setText(titleText);
    }
  }
Пример #3
0
 private void addPointsToPointTextView() {
   int points = gameEventManager.getPoints();
   titleView.setText(titleText + String.valueOf(points));
 }