summaryrefslogtreecommitdiff
path: root/scripts/Actor.cs
diff options
context:
space:
mode:
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