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 38a73799..d3b2b978 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 @@ -155,6 +155,9 @@ public void update() { animate(); runFlag = false; } + if (!enemyDetected() && melee) { + runFlag = true; + } if (melee && enemyDetected() && gameTime.getTime() - lastTimeAttacked >= MELEE_ATTACK_SPEED) { changeState(State.ATTACK); meleeAttackFlag = true; @@ -178,7 +181,9 @@ public void update() { if (animation.isFinished()) { movementTask.start(); changeState(State.RUN); - runFlag = true; + if (!melee) { + runFlag = true; + } } } case DODGE -> {