summaryrefslogtreecommitdiff
path: root/scripts/DungeonLevel.cs
blob: 6fccc20609c5adffab8d509122d5cfcd6ea7b22f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Godot;
using System;

public partial class DungeonLevel : Node2D
{
	public Player player;
	private TileMapLayer buildingLayer;

	private Node2D actors;

	public override void _Ready()
	{
		base._Ready();

		buildingLayer = GetNode<TileMapLayer>("Dungeon");
		actors = GetNode<Node2D>("Actors");
		player = actors.GetNode<Player>("Player");
	}

	public bool IsTileWalkable(Vector2I pos) {
		TileData tile = buildingLayer.GetCellTileData(pos);

		if (tile == null) return false;

		return (bool)tile.GetCustomData("isWalkable");
	}
}