From c9057bbd88f14a4e0e572c16452c1ab9baebfe2a Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 17 Aug 2025 22:30:35 -0300 Subject: Atores agora são criados por código. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/Game.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts/Game.cs') 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("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("Map"); inputHandler = GetNode("InputHandler"); - - player = Map.player; + + player = new Player(new Vector2I(0, 0), Map, playerDefinition); + Camera2D camera = GetNode("Camera2D"); + RemoveChild(camera); + + player.AddChild(camera); + + Map.InsertActor(player); } public override void _PhysicsProcess(double delta) { -- cgit v1.2.3