示例#1
0
 /* (non-Javadoc)
  * @see java.awt.Canvas#paint(java.awt.Graphics)
  */
 @Override
 public void paint(Graphics g) {
   GamePainters.drawBoard(board, g, this);
   GamePainters.drawEnemies(enemies, g, this);
   GamePainters.drawPlayer(player, g, this);
   GamePainters.paintBottomBar(player, board, g, this);
 }
示例#2
0
  /**
   * Creates a new "game" from the current engine.Globals.game variable. While the ANN stays the
   * same, the speed, actor positions, score, et cetera, are all reset.
   */
  public void newGame() {
    stopped = true;
    player.setLives(STARTING_LIVES);
    player.setScore(0);
    Graphics g = strategy.getDrawGraphics();
    waiting = true;

    Globals.state = ENEMY_HUNTER_STATE;

    player.setCenter(board.getPlayerStartPoint());
    player.setDirection(Player.DEFAULT_STARTING_DIRECTION);

    board.reset();
    Globals.blipsLeft = Globals.game.getBoard().getBlipCount();

    for (Enemy enemy : enemies) {
      enemy.reset();
    }

    GamePainters.drawBoard(board, g, this);
    GamePainters.drawEnemies(enemies, g, this);
    GamePainters.drawPlayer(player, g, this);
    GamePainters.paintBottomBar(player, board, g, this);
    strategy.show();
  }
示例#3
0
 /* (non-Javadoc)
  * @see java.awt.Canvas#update(java.awt.Graphics)
  */
 @Override
 public void update(Graphics g) {
   GamePainters.updateBoardForEnemies(enemies, board, g, this);
   GamePainters.updateBoardForPlayer(player, board, g, this);
   GamePainters.drawEnemies(enemies, g, this);
   GamePainters.drawPlayer(player, g, this);
   GamePainters.paintBottomBar(player, board, g, this);
 }
示例#4
0
  /** Updates the canvas. */
  public void update() {
    Graphics g = strategy.getDrawGraphics();

    GamePainters.drawBoard(board, g, this);
    GamePainters.drawEnemies(enemies, g, this);
    GamePainters.drawPlayer(player, g, this);
    GamePainters.paintBottomBar(player, board, g, this);

    strategy.show();
  }
示例#5
0
  /**
   * Causes the ghosts and player to go back to their original starting positions. Used when a
   * player dies, for example.
   */
  public void resetCanvas() {
    Graphics g = strategy.getDrawGraphics();
    waiting = true;

    Globals.state = ENEMY_HUNTER_STATE;

    player.setCenter(board.getPlayerStartPoint());
    player.setDirection(Player.DEFAULT_STARTING_DIRECTION);

    for (Enemy enemy : enemies) {
      enemy.reset();
    }

    GamePainters.drawBoard(board, g, this);
    GamePainters.drawEnemies(enemies, g, this);
    GamePainters.drawPlayer(player, g, this);
    GamePainters.paintBottomBar(player, board, g, this);
    strategy.show();
  }