summaryrefslogtreecommitdiff
path: root/scripts/actors
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/actors')
-rw-r--r--scripts/actors/Actor.cs2
-rw-r--r--scripts/actors/Inspector.cs39
-rw-r--r--scripts/actors/Inspector.cs.uid1
3 files changed, 41 insertions, 1 deletions
diff --git a/scripts/actors/Actor.cs b/scripts/actors/Actor.cs
index 2d22d44..80e8c1d 100644
--- a/scripts/actors/Actor.cs
+++ b/scripts/actors/Actor.cs
@@ -4,7 +4,7 @@ using Godot;
/// A classe de ator define um personagem no jogo.
/// </summary>
[GlobalClass]
-public abstract partial class Actor : Sprite2D
+public partial class Actor : Sprite2D
{
/// <summary>
/// Sinal emitido toda vez que o HP mudar.
diff --git a/scripts/actors/Inspector.cs b/scripts/actors/Inspector.cs
new file mode 100644
index 0000000..0bdab5b
--- /dev/null
+++ b/scripts/actors/Inspector.cs
@@ -0,0 +1,39 @@
+using Godot;
+
+/// <summary>
+/// Isto é uma abominação
+/// </summary>
+public partial class Inspector : Sprite2D
+{
+ private static readonly Texture2D texture = GD.Load<Texture2D>("res://assets/sprites/inspector.png");
+
+ private Vector2I gridPosition = Vector2I.Zero;
+ /// <summary>
+ /// Posição do inspetor no espaço. Diferentemente de Position, GridPosition tem como formato
+ /// os tiles do mapa.
+ /// </summary>
+ public Vector2I GridPosition {
+ set {
+ gridPosition = value;
+ // O sistema de coordenadas do Godot é em pixels, mas faz mais sentido para o jogo utilizar coordenadas em tiles.
+ // Esta propriedade converte um sistema para o outro automaticamente.
+ Position = Grid.GridToWorld(value);
+ }
+ get => gridPosition;
+ }
+
+ public Inspector(Vector2I initialPosition)
+ {
+ GridPosition = initialPosition;
+ Centered = false;
+ Texture = texture;
+ }
+
+ /// <summary>
+ /// O Inspetor não faz parte do mapa.
+ /// </summary>
+ /// <param name="offset"></param>
+ public void Walk(Vector2I offset) {
+ GridPosition += offset;
+ }
+} \ No newline at end of file
diff --git a/scripts/actors/Inspector.cs.uid b/scripts/actors/Inspector.cs.uid
new file mode 100644
index 0000000..ca411e4
--- /dev/null
+++ b/scripts/actors/Inspector.cs.uid
@@ -0,0 +1 @@
+uid://dxsrtu4b3pi08