summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Actor.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/Actor.cs b/scripts/Actor.cs
index e3c74a4..d196940 100644
--- a/scripts/Actor.cs
+++ b/scripts/Actor.cs
@@ -18,8 +18,10 @@ public abstract partial class Actor : Node2D {
TileData tile = Map.GetCellTileData(toMovePos);
- if (tile.HasCustomData("isWalkable") && (bool) tile.GetCustomData("isWalkable")) {
- Position = Map.MapToLocal(toMovePos);
+ if (tile != null) {
+ if ((bool) tile.GetCustomData("isWalkable")) {
+ Position = Map.MapToLocal(toMovePos);
+ }
}
Energy -= baseWalkCost;