summaryrefslogtreecommitdiff
path: root/scripts/Entities/Actors/AI/HostileEnemyAI.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Entities/Actors/AI/HostileEnemyAI.cs')
-rw-r--r--scripts/Entities/Actors/AI/HostileEnemyAI.cs3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/Entities/Actors/AI/HostileEnemyAI.cs b/scripts/Entities/Actors/AI/HostileEnemyAI.cs
index dbcf98d..2f925c1 100644
--- a/scripts/Entities/Actors/AI/HostileEnemyAI.cs
+++ b/scripts/Entities/Actors/AI/HostileEnemyAI.cs
@@ -1,5 +1,6 @@
using Godot;
using TheLegendOfGustav.Entities.Actions;
+using TheLegendOfGustav.Utils;
namespace TheLegendOfGustav.Entities.Actors.AI;
@@ -21,7 +22,7 @@ public partial class HostileEnemyAI : BaseAI
Vector2I offset = target.GridPosition - Body.GridPosition;
// Distância entre o inimigo e o jogador. Leva em consideração somente
// um dos eixos.
- int distance = int.Max(int.Abs(offset.X), int.Abs(offset.Y));
+ int distance = Grid.Distance(Body.GridPosition, target.GridPosition);
// A ação executada no turno pode ser de ataque ou de movimento.
Action action;