summaryrefslogtreecommitdiff
path: root/scripts/Entities
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-10 12:34:20 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-10 12:34:37 -0300
commitb8962990ddb75b874a49c83d8eeaba7b7e45c196 (patch)
tree68124e2d5b87f17c6f778e8088a148745621feb9 /scripts/Entities
parentc6bbb834f7758027c0df338f1520f34fad3befea (diff)
Centralização da lógica de distância.
Diffstat (limited to 'scripts/Entities')
-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;