From 6fb1eb6a6fe0f3f4c2f4e9d7fc476566168eba5d Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 17 Aug 2025 20:03:46 -0300 Subject: Refactor --- scripts/DungeonLevel.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts/DungeonLevel.cs') diff --git a/scripts/DungeonLevel.cs b/scripts/DungeonLevel.cs index a303254..6fccc20 100644 --- a/scripts/DungeonLevel.cs +++ b/scripts/DungeonLevel.cs @@ -4,7 +4,7 @@ using System; public partial class DungeonLevel : Node2D { public Player player; - public TileMapLayer buildingLayer; + private TileMapLayer buildingLayer; private Node2D actors; @@ -16,4 +16,12 @@ public partial class DungeonLevel : Node2D actors = GetNode("Actors"); player = actors.GetNode("Player"); } + + public bool IsTileWalkable(Vector2I pos) { + TileData tile = buildingLayer.GetCellTileData(pos); + + if (tile == null) return false; + + return (bool)tile.GetCustomData("isWalkable"); + } } -- cgit v1.2.3