From c0424444b9f3d864d039220134ae302a26c62154 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Fri, 11 Oct 2024 19:00:19 -0700 Subject: [PATCH] Make Doc dash away instead of predetermined angle --- State/Thinker/DashDefensive.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/State/Thinker/DashDefensive.cs b/State/Thinker/DashDefensive.cs index 8bde545..909637d 100644 --- a/State/Thinker/DashDefensive.cs +++ b/State/Thinker/DashDefensive.cs @@ -47,7 +47,10 @@ public partial class DashDefensive : AttackState { GD.Print("changing direction"); var direction = projectile.Direction; - DashTo(direction.Rotated(Mathf.Pi / 2)); + var dirToChar = projectile.GlobalPosition + .DirectionTo(NPC.GlobalPosition); + var lateralDirection = Mathf.Sign(direction.Cross(dirToChar)); + DashTo(direction.Rotated(lateralDirection * Mathf.Pi / 2)); } } }