diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 19:32:36 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 19:32:36 -0300 |
| commit | ca782d7310f2df854a8727535ac92337c85ed445 (patch) | |
| tree | 7df571c01d48cac56fb8362d4d091bdd2a55c09a /scripts/actors/Actor.cs | |
| parent | adb86dd1725276457c13e9a4d37372fda628dea3 (diff) | |
Gigantesco refactor
Diffstat (limited to 'scripts/actors/Actor.cs')
| -rw-r--r-- | scripts/actors/Actor.cs | 23 |
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 |
