Enemy FSM Animation

This commit is contained in:
Marco 2025-03-21 15:16:50 +01:00
commit e7c1814d98
12 changed files with 161 additions and 6 deletions

View file

@ -89,4 +89,16 @@ public static class Tools
return angles[Mathf.PosMod((int)(direction.X + 4), 8)].Normalized();
}
public static Vector2 SnapToCardinal(this Vector2 input)
{
if (Mathf.Abs(input.X) > Mathf.Abs(input.Y))
{
return new Vector2(Mathf.Sign(input.X), 0); // Left or Right
}
else
{
return new Vector2(0, Mathf.Sign(input.Y)); // Up or Down
}
}
}