summaryrefslogtreecommitdiff
path: root/scripts/actors/Inspector.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-09-02 12:50:09 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-09-02 12:50:09 -0300
commit6842ccfd372601db6b5d3f678ab5ebf03ad2b206 (patch)
tree572c89e5d266087f18c763bec3085dca3f29bdb6 /scripts/actors/Inspector.cs
parent4be033a60846cbdd290da27be44f270eba5a964d (diff)
Adicionado entidade Inspetor.
Diffstat (limited to 'scripts/actors/Inspector.cs')
-rw-r--r--scripts/actors/Inspector.cs39
1 files changed, 39 insertions, 0 deletions
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