From 10c630d534ea2ad145f650836d60cc00afaa2780 Mon Sep 17 00:00:00 2001 From: Deven Bhasin Date: Sun, 10 Sep 2023 01:58:40 +1000 Subject: [PATCH] Removed Wave --- .../csse3200/game/areas/ForestGameArea.java | 38 ++----------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java index 90c81257d..33554bf85 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -41,8 +41,7 @@ public class ForestGameArea extends GameArea { private Timer bossSpawnTimer; private int bossSpawnInterval = 10000; // 1 minute in milliseconds - private int wave = 0; - private Timer waveTimer; + private static final int NUM_WEAPON_TOWERS = 3; private static final GridPoint2 PLAYER_SPAWN = new GridPoint2(0, 0); @@ -137,37 +136,6 @@ public class ForestGameArea extends GameArea { private Entity bossKing1; private Entity bossKing2; - // Add this method to start the wave spawning timer when the game starts. - private void startWaveTimer() { - waveTimer = new Timer(); - waveTimer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - spawnWave(); - } - }, 0, 10000); // 10000 milliseconds = 10 seconds - } - - // Add this method to stop the wave timer when the game ends or as needed. - private void stopWaveTimer() { - if (waveTimer != null) { - waveTimer.cancel(); - waveTimer = null; - } - } - - private void spawnWave() { - wave++; - switch (wave) { - case 1, 2 -> spawnXenoGrunts(); - case 3 -> spawnBossKing1(); - case 4 -> spawnBossKing2(); - default -> { - } - // Handle other wave scenarios if needed - } - } - /** * Initialise this ForestGameArea to use the provided TerrainFactory. @@ -199,7 +167,8 @@ public void create() { spawnGhosts(); spawnWeaponTower(); spawnEngineer(); - startWaveTimer(); + bossKing1 = spawnBossKing1(); + bossKing2 = spawnBossKing2(); spawnTNTTower(); } @@ -507,7 +476,6 @@ public void dispose() { super.dispose(); ServiceLocator.getResourceService().getAsset(backgroundMusic, Music.class).stop(); this.unloadAssets(); - stopWaveTimer(); } private void spawnScrap() {