Skip to content

Commit

Permalink
fixed patrick melee attack null target bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gregchan550 committed Oct 3, 2023
1 parent fadbb69 commit f9f5aa6
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ private void meleeAttack() {
initialPos = patrick.getPosition();
meleeTarget = ServiceLocator.getEntityService().getClosestEntityOfLayer(
patrick, PhysicsLayer.HUMANS);
// check if melee target exists
if (meleeTarget == null) {
return;
}
teleport(meleeTarget.getPosition());
meleeFlag = true;
}
Expand Down

0 comments on commit f9f5aa6

Please sign in to comment.