Skip to content

Commit

Permalink
fixed bug where melee mob was moving in between attacks so itd get to…
Browse files Browse the repository at this point in the history
…o close and not attack anymore
  • Loading branch information
gregchan550 committed Oct 17, 2023
1 parent 3330c63 commit 6a870fd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -178,7 +181,9 @@ public void update() {
if (animation.isFinished()) {
movementTask.start();
changeState(State.RUN);
runFlag = true;
if (!melee) {
runFlag = true;
}
}
}
case DODGE -> {
Expand Down

0 comments on commit 6a870fd

Please sign in to comment.