summaryrefslogtreecommitdiff
path: root/scripts/map/Map.cs
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/map/Map.cs')
-rw-r--r--scripts/map/Map.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/scripts/map/Map.cs b/scripts/map/Map.cs
index 41bd7f8..52ff588 100644
--- a/scripts/map/Map.cs
+++ b/scripts/map/Map.cs
@@ -8,21 +8,32 @@ public partial class Map : Node2D
[Export]
private int fovRadius = 12;
- DungeonGenerator generator;
+ private DungeonGenerator generator;
FieldOfView fieldOfView;
+ private Node2D tilesNode;
+ private Node2D actorsNode;
+
public override void _Ready()
{
base._Ready();
generator = GetNode<DungeonGenerator>("Generator");
fieldOfView = GetNode<FieldOfView>("FieldOfView");
+ tilesNode = GetNode<Node2D>("Tiles");
+ actorsNode = GetNode<Node2D>("Actors");
}
private void PlaceTiles() {
foreach (Tile tile in Map_Data.Tiles) {
- AddChild(tile);
+ tilesNode.AddChild(tile);
+ }
+ }
+
+ private void PlaceActors() {
+ foreach (Actor actor in Map_Data.Actors) {
+ actorsNode.AddChild(actor);
}
}
@@ -30,11 +41,10 @@ public partial class Map : Node2D
{
Map_Data = generator.GenerateDungeon(player);
- Map_Data.InsertActor(player);
-
player.Map_Data = Map_Data;
PlaceTiles();
+ PlaceActors();
}
public void UpdateFOV(Vector2I pos) {