diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-09 19:09:34 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-09 19:09:34 -0300 |
| commit | c6bbb834f7758027c0df338f1520f34fad3befea (patch) | |
| tree | 1818cd23c24be16fbe19b16dd0a510874d440d83 /scripts/Utils/Grid.cs | |
| parent | f1b51bed52ffbd90b5b7cc8dcfc6f0484bbbeb3c (diff) | |
Organização
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; } } |
