@Override public void update() { if (paused) { return; } eManager.update(); tManager.update(eManager.getLiveEnemies()); if (player.getLives() <= 0) { gsm.setState(GameStateManager.GAMEOVERSTATE); } }
@Override public void draw(Graphics2D g) { tileMap.draw(g); eManager.draw(g); tManager.draw(g); player.draw(g); }
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; }
@Override public HashMap<String, String> getStateData() { HashMap<String, String> data = new HashMap<String, String>(); data.put("wave", Integer.toString(eManager.getWave())); return data; }
@Override public void mousePressed(MouseEvent e) { tManager.mousePressed(e); eManager.mousePressed(e); }