Skip to content

Commit

Permalink
Fixed issue where mob count was not decreasing. Added in updateEnemyC…
Browse files Browse the repository at this point in the history
…ount call to MobTask
  • Loading branch information
meganroxburgh committed Oct 14, 2023
1 parent 3d08ddf commit ad771f0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,12 @@ public void create() {
spawnTerrain();

// Set up infrastructure for end game tracking
player = spawnPlayer();
// player = spawnPlayer();

waves = WaveFactory.createWaves();
spawnEntity(waves);
waves.getEvents().addListener("spawnWave", this::spawnMob);
logger.info("Creating waves");
waves = WaveFactory.createWaves();
spawnEntity(waves);
waves.getEvents().addListener("spawnWave", this::spawnMob);
// spawnCoat();
// spawnDodgingDragonKnight(17,4);
// spawnDeflectWizard(17, 3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void update() {
movementTask.stop();
deathFlag = true;
} else if (deathFlag && animation.isFinished()) {
ServiceLocator.getWaveService().updateEnemyCount();
mob.setFlagForDelete(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void start() {
this.level = (LevelWaves) this.owner.getEntity();
this.currentWave = level.getWave(currentWaveIndex);
ServiceLocator.getWaveService().setEnemyCount(currentWave.getSize());
// logger.info("Wave {} starting with {} enemies", currentWaveIndex, ServiceLocator.getWaveService().getEnemyCount());
logger.info("Wave {} starting with {} enemies", currentWaveIndex, ServiceLocator.getWaveService().getEnemyCount());
this.waveStart.play();
// endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000);
}
Expand Down Expand Up @@ -116,7 +116,6 @@ public void update() {
ServiceLocator.getWaveService().setNextWaveTime(nextWaveAt);
} else {
if (globalTime.getTime() >= nextWaveAt || ServiceLocator.getWaveService().shouldSkip()) {
logger.info("Next wave starting");
ServiceLocator.getWaveService().toggleDelay();
currentWaveIndex++;
ServiceLocator.getWaveService().setNextWaveTime(0);
Expand All @@ -128,6 +127,7 @@ public void update() {
ServiceLocator.getWaveService().setWaveCount(currentWaveIndex);
this.currentWave = this.level.getWave(currentWaveIndex);
ServiceLocator.getWaveService().setEnemyCount(currentWave.getSize());
logger.info("Next wave {} starting with {} enemies", currentWaveIndex, ServiceLocator.getWaveService().getEnemyCount());
//endTime = globalTime.getTime() + (SPAWNING_INTERVAL * 1000L); // reset end time
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static Entity createWaves() {
break;
default:
difficulty = 2;
maxWaves = 5;
maxWaves = 2; //change back to 5
}

LevelWaves level = createLevel(difficulty, maxWaves, chosenLevel);
Expand Down

0 comments on commit ad771f0

Please sign in to comment.