Skip to content

Commit

Permalink
Removed Wave
Browse files Browse the repository at this point in the history
  • Loading branch information
DevenBhasin committed Sep 9, 2023
1 parent a7e855e commit 10c630d
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions source/core/src/main/com/csse3200/game/areas/ForestGameArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -199,7 +167,8 @@ public void create() {
spawnGhosts();
spawnWeaponTower();
spawnEngineer();
startWaveTimer();
bossKing1 = spawnBossKing1();
bossKing2 = spawnBossKing2();
spawnTNTTower();
}

Expand Down Expand Up @@ -507,7 +476,6 @@ public void dispose() {
super.dispose();
ServiceLocator.getResourceService().getAsset(backgroundMusic, Music.class).stop();
this.unloadAssets();
stopWaveTimer();
}

private void spawnScrap() {
Expand Down

0 comments on commit 10c630d

Please sign in to comment.