diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-02 12:50:09 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-09-02 12:50:09 -0300 |
| commit | 6842ccfd372601db6b5d3f678ab5ebf03ad2b206 (patch) | |
| tree | 572c89e5d266087f18c763bec3085dca3f29bdb6 /scripts/actors | |
| parent | 4be033a60846cbdd290da27be44f270eba5a964d (diff) | |
Adicionado entidade Inspetor.
Diffstat (limited to 'scripts/actors')
| -rw-r--r-- | scripts/actors/Actor.cs | 2 | ||||
| -rw-r--r-- | scripts/actors/Inspector.cs | 39 | ||||
| -rw-r--r-- | scripts/actors/Inspector.cs.uid | 1 |
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 |
