diff options
Diffstat (limited to 'scripts/Game.cs')
| -rw-r--r-- | scripts/Game.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/scripts/Game.cs b/scripts/Game.cs index f5c5240..836af84 100644 --- a/scripts/Game.cs +++ b/scripts/Game.cs @@ -3,24 +3,35 @@ using System; public partial class Game : Node { private static readonly ActorDefinition playerDefinition = GD.Load<ActorDefinition>("res://assets/definitions/actor/Player.tres"); + private static readonly ActorDefinition skeletonDefinition = GD.Load<ActorDefinition>("res://assets/definitions/actor/Skeleton.tres"); private Player player; - public DungeonLevel Map { get; private set; } + private Node2D actorsNode; + public MapData Map_Data { get; private set; } private InputHandler inputHandler; public override void _Ready() { base._Ready(); - Map = GetNode<DungeonLevel>("Map"); + Map Map = GetNode<Map>("Map"); + + Map_Data = Map.Map_Data; inputHandler = GetNode<InputHandler>("InputHandler"); + actorsNode = GetNode<Node2D>("Actors"); - player = new Player(new Vector2I(0, 0), Map, playerDefinition); + player = new Player(Vector2I.Zero, Map_Data, playerDefinition); Camera2D camera = GetNode<Camera2D>("Camera2D"); RemoveChild(camera); player.AddChild(camera); - Map.InsertActor(player); + actorsNode.AddChild(player); + + Enemy Skeleton = new Enemy(Vector2I.Zero, Map_Data, skeletonDefinition); + actorsNode.AddChild(Skeleton); + + Map_Data.InsertActor(new Vector2I(1, 1), player); + Map_Data.InsertActor(new Vector2I(3, 4), Skeleton); } public override void _PhysicsProcess(double delta) { @@ -35,7 +46,7 @@ public partial class Game : Node { } private void HandleEnemyTurns() { - foreach (Actor actor in Map.Actors) { + foreach (Actor actor in Map_Data.Actors) { if (actor is Player) continue; GD.Print($"O {actor.ActorName} foi cuckado e não tem como agir."); |
