diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 20:18:47 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 20:18:47 -0300 |
| commit | bf74afcdd07e59b1a48dbfacdce9d52fad765865 (patch) | |
| tree | 53ac9b8d61f7afa553ddafa0f22e2cf6014e55be /scripts/DungeonLevel.cs | |
| parent | 6fb1eb6a6fe0f3f4c2f4e9d7fc476566168eba5d (diff) | |
Inimigos sólidos.
Diffstat (limited to 'scripts/DungeonLevel.cs')
| -rw-r--r-- | scripts/DungeonLevel.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/scripts/DungeonLevel.cs b/scripts/DungeonLevel.cs index 6fccc20..d3a5aee 100644 --- a/scripts/DungeonLevel.cs +++ b/scripts/DungeonLevel.cs @@ -5,16 +5,18 @@ public partial class DungeonLevel : Node2D { public Player player; private TileMapLayer buildingLayer; + [Export] + private Godot.Collections.Array<Actor> actors = []; - private Node2D actors; + private Node2D actorsNode; public override void _Ready() { base._Ready(); buildingLayer = GetNode<TileMapLayer>("Dungeon"); - actors = GetNode<Node2D>("Actors"); - player = actors.GetNode<Player>("Player"); + actorsNode = GetNode<Node2D>("Actors"); + player = actorsNode.GetNode<Player>("Player"); } public bool IsTileWalkable(Vector2I pos) { @@ -24,4 +26,13 @@ public partial class DungeonLevel : Node2D return (bool)tile.GetCustomData("isWalkable"); } + + public Actor GetBlockingActorAtPosition(Vector2I pos) { + foreach (Actor actor in actors) { + if (actor.GridPosition == pos && actor.BlocksMovement) { + return actor; + } + } + return null; + } } |
