From 6471007caaf1702e27d747bee36b6f96ffe9e4da Mon Sep 17 00:00:00 2001 From: Kevin <104761532+Hasakev@users.noreply.github.com> Date: Tue, 17 Oct 2023 12:36:08 +1000 Subject: [PATCH] Moved logic of engineer death when Mob reaches end --- .../src/main/com/csse3200/game/areas/ForestGameArea.java | 2 +- .../com/csse3200/game/components/tasks/MobTask/MobTask.java | 5 +++-- .../csse3200/game/components/tasks/bosstask/IceBabyTask.java | 4 ++-- 3 files changed, 6 insertions(+), 5 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 bced9162..96a2be3b 100644 --- a/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java +++ b/source/core/src/main/com/csse3200/game/areas/ForestGameArea.java @@ -293,7 +293,7 @@ public void create() { waves.getEvents().addListener("spawnWave", this::spawnMob); spawnScrap(); - spawnGapScanners(); +// spawnGapScanners(); } private void displayUI() { diff --git a/source/core/src/main/com/csse3200/game/components/tasks/MobTask/MobTask.java b/source/core/src/main/com/csse3200/game/components/tasks/MobTask/MobTask.java index 150414c5..aaa3786c 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/MobTask/MobTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/MobTask/MobTask.java @@ -128,18 +128,19 @@ public void update() { if(mob.getCenterPosition().x <= 1) { mob.getComponent(CombatStatsComponent.class).setHealth(0); - ServiceLocator.getGameEndService().updateEngineerCount(); + } // death check if ((mob.getComponent(CombatStatsComponent.class).getHealth() <= 0 && !deathFlag)) { // decrement engineer count // ! tests failing because of textbox - + ServiceLocator.getGameEndService().updateEngineerCount(); changeState(State.DEATH); animate(); movementTask.stop(); deathFlag = true; + } else if (deathFlag && animation.isFinished()) { ServiceLocator.getWaveService().updateEnemyCount(); diff --git a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java index b4f5c845..a2f19552 100644 --- a/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java +++ b/source/core/src/main/com/csse3200/game/components/tasks/bosstask/IceBabyTask.java @@ -39,8 +39,8 @@ public class IceBabyTask extends DefaultTask implements PriorityTask { private Vector2 currentPos; private Vector2 walkPos; private MovementTask walkTask; - private static int xRightBoundary = 17; - private static int xLeftBoundary = 12; + private int xRightBoundary = 17; + private int xLeftBoundary = 12; private boolean startFlag = false; private boolean isWalking; /** Animation constants */