Exemplo n.º 1
0
  public void loadGame() {
    this.stopped = true;
    this.board = Globals.game.getBoard();
    this.enemies = Globals.game.getEnemies();
    this.setBounds(0, 0, board.getColumns() * TILE_WIDTH, board.getRows() * TILE_HEIGHT + 20);

    newGame();
  }
Exemplo n.º 2
0
  /**
   * @param enemies An array of the different enemies
   * @param board The current board (level)
   */
  public LevelCanvas(Enemy[] enemies, Board board) {
    super();
    this.enemies = enemies;
    this.player = Globals.game.getPlayer();
    this.board = board;
    this.stopped = false;
    this.waiting = true;
    this.addKeyListener(this);
    this.setIgnoreRepaint(true);
    this.setBounds(0, 0, board.getColumns() * TILE_WIDTH, board.getRows() * TILE_HEIGHT + 20);
    this.addFocusListener(
        new FocusListener() {
          public void focusLost(FocusEvent e) {
            update();
          }

          public void focusGained(FocusEvent e) {
            update();
          }
        });
  }