summaryrefslogtreecommitdiff
path: root/scripts/actors/Actor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/actors/Actor.cs')
-rw-r--r--scripts/actors/Actor.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/actors/Actor.cs b/scripts/actors/Actor.cs
new file mode 100644
index 0000000..8e33b02
--- /dev/null
+++ b/scripts/actors/Actor.cs
@@ -0,0 +1,23 @@
+using Godot;
+
+[GlobalClass]
+public abstract partial class Actor : Sprite2D {
+ private Vector2I gridPosition = Vector2I.Zero;
+ public Vector2I GridPosition {
+ set {
+ gridPosition = value;
+ Position = Grid.GridToWorld(value);
+ }
+ get => gridPosition;
+ }
+
+ public override void _Ready()
+ {
+ base._Ready();
+ GridPosition = Grid.WorldToGrid(Position);
+ }
+
+ public void Walk(Vector2I offset) {
+ GridPosition += offset;
+ }
+} \ No newline at end of file