mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 23:35:54 +00:00
Enemy FSM Animation
This commit is contained in:
parent
dd3d427ac3
commit
e7c1814d98
12 changed files with 161 additions and 6 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue