summaryrefslogtreecommitdiff
path: root/scripts/actors
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/actors
parent240156765d88db25dd092fc320005cdb5f28d7a7 (diff)
Atores agora são criados por código.
Diffstat (limited to 'scripts/actors')
-rw-r--r--scripts/actors/Actor.cs11
-rw-r--r--scripts/actors/ActorDefinition.cs2
-rw-r--r--scripts/actors/Player.cs4
3 files changed, 14 insertions, 3 deletions
diff --git a/scripts/actors/Actor.cs b/scripts/actors/Actor.cs
index f429ead..7e9ab04 100644
--- a/scripts/actors/Actor.cs
+++ b/scripts/actors/Actor.cs
@@ -3,11 +3,18 @@ using Godot;
[GlobalClass]
public abstract partial class Actor : Sprite2D
{
- [Export]
private ActorDefinition definition;
private Vector2I gridPosition = Vector2I.Zero;
- [Export]
public DungeonLevel Map { get; private set; }
+
+ public Actor(Vector2I initialPosition, DungeonLevel map, ActorDefinition definition) {
+ GridPosition = initialPosition;
+ Map = map;
+ this.definition = definition;
+ Texture = definition.texture;
+ Centered = false;
+ }
+
public Vector2I GridPosition {
set {
gridPosition = value;
diff --git a/scripts/actors/ActorDefinition.cs b/scripts/actors/ActorDefinition.cs
index 58a749c..5678921 100644
--- a/scripts/actors/ActorDefinition.cs
+++ b/scripts/actors/ActorDefinition.cs
@@ -7,6 +7,8 @@ public partial class ActorDefinition : Resource
[ExportCategory("Visuals")]
[Export]
public string name = "unnamed";
+ [Export]
+ public Texture2D texture;
[ExportCategory("Mechanics")]
[Export]
diff --git a/scripts/actors/Player.cs b/scripts/actors/Player.cs
index c8abe12..590020d 100644
--- a/scripts/actors/Player.cs
+++ b/scripts/actors/Player.cs
@@ -4,5 +4,7 @@ using System;
[GlobalClass]
public partial class Player : Actor
{
-
+ public Player(Vector2I initialPosition, DungeonLevel map, ActorDefinition definition) : base(initialPosition, map, definition)
+ {
+ }
}