Ejemplo n.º 1
0
  /**
   * Updates the game once the individual characters have been updated: check if anyone can eat
   * anyone else. Then update the lair times and check if Ms Pac-Man should be awarded the extra
   * live. Then update the time and see if the level or game is over.
   */
  public void updateGame() {
    _feast(); // ghosts eat pac-man or vice versa
    _updateLairTimes();
    _updatePacManExtraLife();

    tiempoTotal++;
    tiempoLvlActual++;

    _checkLevelState(); // check if level/game is over
  }
Ejemplo n.º 2
0
  /**
   * This method is for specific purposes such as searching a tree in a specific manner. It has to
   * be used cautiously as it might create an unstable game state and may cause the game to crash.
   *
   * @param feast Whether or not to enable feasting
   * @param updateLairTimes Whether or not to update the lair times
   * @param updateExtraLife Whether or not to update the extra life
   * @param updateTotalTime Whether or not to update the total time
   * @param updateLevelTime Whether or not to update the level time
   */
  public void updateGame(
      boolean feast,
      boolean updateLairTimes,
      boolean updateExtraLife,
      boolean updateTotalTime,
      boolean updateLevelTime) {
    if (feast) _feast(); // ghosts eat pac-man or vice versa	
    if (updateLairTimes) _updateLairTimes();
    if (updateExtraLife) _updatePacManExtraLife();

    if (updateTotalTime) tiempoTotal++;
    if (updateLevelTime) tiempoLvlActual++;

    _checkLevelState(); // check if level/game is over
  }