示例#1
0
  @Override
  public void update() {
    if (paused) {
      return;
    }
    eManager.update();
    tManager.update(eManager.getLiveEnemies());

    if (player.getLives() <= 0) {
      gsm.setState(GameStateManager.GAMEOVERSTATE);
    }
  }
示例#2
0
 @Override
 public void draw(Graphics2D g) {
   tileMap.draw(g);
   eManager.draw(g);
   tManager.draw(g);
   player.draw(g);
 }
示例#3
0
  public void init() {
    // Create map object and load map file
    tileMap = new TDMap(GamePanel.PIXEL_WIDTH, GamePanel.PIXEL_HEIGHT, GamePanel.TILE_SIZE, false);
    tileMap.loadMap("./maps/new2.tdm");

    player = new Player(START_MONEY, START_LIVES);

    eManager = new EnemyManager(tileMap, player);
    eManager.start();

    tManager = new TowerManager(tileMap, player);

    paused = false;
  }
示例#4
0
 @Override
 public HashMap<String, String> getStateData() {
   HashMap<String, String> data = new HashMap<String, String>();
   data.put("wave", Integer.toString(eManager.getWave()));
   return data;
 }
示例#5
0
 @Override
 public void mousePressed(MouseEvent e) {
   tManager.mousePressed(e);
   eManager.mousePressed(e);
 }