diff options
Diffstat (limited to 'scripts/Utils/Grid.cs')
| -rw-r--r-- | scripts/Utils/Grid.cs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/Utils/Grid.cs b/scripts/Utils/Grid.cs index 271f559..b744c60 100644 --- a/scripts/Utils/Grid.cs +++ b/scripts/Utils/Grid.cs @@ -1,5 +1,6 @@ using Godot; -using System; + +namespace TheLegendOfGustav.Utils; /// <summary> /// Classe utilitária para converter coordenadas da malha dos tiles @@ -7,14 +8,17 @@ using System; /// Esta classe é necessária porque o Godot trata posições em pixels, /// mas faz mais sentido tratarmos as posições em tiles. /// </summary> -public abstract partial class Grid : GodotObject { +public abstract partial class Grid : GodotObject +{ public static readonly Vector2I tileSize = new(16, 16); - public static Vector2I WorldToGrid(Vector2 coord) { + public static Vector2I WorldToGrid(Vector2 coord) + { return (Vector2I)(coord / tileSize); } - public static Vector2 GridToWorld(Vector2I coord) { + public static Vector2 GridToWorld(Vector2I coord) + { return coord * tileSize; } } |
