summaryrefslogtreecommitdiff
path: root/scripts/Game.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 22:30:35 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 22:30:35 -0300
commitc9057bbd88f14a4e0e572c16452c1ab9baebfe2a (patch)
tree61e22e427354995cabe878d7a9f14fb9804c9c8f /scripts/Game.cs
parent240156765d88db25dd092fc320005cdb5f28d7a7 (diff)
Atores agora são criados por código.
Diffstat (limited to 'scripts/Game.cs')
-rw-r--r--scripts/Game.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/Game.cs b/scripts/Game.cs
index 067f4a4..f5c5240 100644
--- a/scripts/Game.cs
+++ b/scripts/Game.cs
@@ -2,6 +2,7 @@ using Godot;
using System;
public partial class Game : Node {
+ private static readonly ActorDefinition playerDefinition = GD.Load<ActorDefinition>("res://assets/definitions/actor/Player.tres");
private Player player;
public DungeonLevel Map { get; private set; }
private InputHandler inputHandler;
@@ -12,8 +13,14 @@ public partial class Game : Node {
Map = GetNode<DungeonLevel>("Map");
inputHandler = GetNode<InputHandler>("InputHandler");
-
- player = Map.player;
+
+ player = new Player(new Vector2I(0, 0), Map, playerDefinition);
+ Camera2D camera = GetNode<Camera2D>("Camera2D");
+ RemoveChild(camera);
+
+ player.AddChild(camera);
+
+ Map.InsertActor(player);
}
public override void _PhysicsProcess(double delta) {