diff options
Diffstat (limited to 'scripts/Utils')
| -rw-r--r-- | scripts/Utils/Grid.cs | 14 | ||||
| -rw-r--r-- | scripts/Utils/Grid.cs.uid | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/scripts/Utils/Grid.cs b/scripts/Utils/Grid.cs new file mode 100644 index 0000000..bf5d98f --- /dev/null +++ b/scripts/Utils/Grid.cs @@ -0,0 +1,14 @@ +using Godot; +using System; + +public partial class Grid : GodotObject { + public static readonly Vector2I tileSize = new(16, 16); + + public static Vector2I WorldToGrid(Vector2 coord) { + return (Vector2I)(coord / tileSize); + } + + public static Vector2 GridToWorld(Vector2I coord) { + return coord * tileSize; + } +} diff --git a/scripts/Utils/Grid.cs.uid b/scripts/Utils/Grid.cs.uid new file mode 100644 index 0000000..c18e354 --- /dev/null +++ b/scripts/Utils/Grid.cs.uid @@ -0,0 +1 @@ +uid://75s33rka6l60 |
