summaryrefslogtreecommitdiff
path: root/scripts/Actor.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-16 14:22:04 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-16 14:22:04 -0300
commitc411c496394c7a782854e03f2be8fab4cc1e2a81 (patch)
tree6cecaa0f70c9b3fd49a9fce9b383d46c27c41dcd /scripts/Actor.cs
parent588a80a339a64f15b2e3bada550beb14e16abe3e (diff)
Herança e preparativos para o sistema de turnos
Diffstat (limited to 'scripts/Actor.cs')
-rw-r--r--scripts/Actor.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/Actor.cs b/scripts/Actor.cs
new file mode 100644
index 0000000..fc69edf
--- /dev/null
+++ b/scripts/Actor.cs
@@ -0,0 +1,18 @@
+using Godot;
+
+public partial class Actor : Node2D {
+ [Export]
+ public TileMapLayer Map { get; set; }
+
+ protected void Walk(Vector2I offset) {
+ Vector2I toMovePos = Map.LocalToMap(Position);
+ toMovePos += offset;
+
+ TileData tile = Map.GetCellTileData(toMovePos);
+
+ if (tile.HasCustomData("isWalkable") && (bool) tile.GetCustomData("isWalkable")) {
+ GD.Print(toMovePos);
+ Position = Map.MapToLocal(toMovePos);
+ }
+ }
+} \ No newline at end of file