From adb86dd1725276457c13e9a4d37372fda628dea3 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 16 Aug 2025 21:30:24 -0300 Subject: Verificar se o tile é nulo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolve o problema #2 --- scripts/Actor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') 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; -- cgit v1.2.3