diff options
| author | matheus20337 <149222182+matheus20337@users.noreply.github.com> | 2025-08-16 20:32:15 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-16 20:32:15 +0000 |
| commit | 7f6f4df85368a328ce69fb0b244a706b7dbfc6aa (patch) | |
| tree | 26961e5c63e87c5d1c17422cdf6ab4493b2d8f55 /scripts/Character.cs | |
| parent | e159be9bbbf005785bd2d60af8b5c3df608f28b2 (diff) | |
| parent | b05cfd5577884d1a398dbb226e2082af5fe8f8fa (diff) | |
Merge pull request #1 from Simplesmente-O-Grupo/Matheus
Sistema de turnos
Diffstat (limited to 'scripts/Character.cs')
| -rw-r--r-- | scripts/Character.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/Character.cs b/scripts/Character.cs new file mode 100644 index 0000000..172ffe4 --- /dev/null +++ b/scripts/Character.cs @@ -0,0 +1,51 @@ +using Godot; +using System; + +public partial class Character : Actor { + private bool canAct = false; + + public override void _Input(InputEvent @event) + { + base._Input(@event); + + if (!@event.IsPressed()) return; + + if (canAct) { + + + if (@event.IsActionPressed("walk-up")) { + Walk(Vector2I.Up); + } + if (@event.IsActionPressed("walk-down")) { + Walk(Vector2I.Down); + } + if (@event.IsActionPressed("walk-left")) { + Walk(Vector2I.Left); + } + if (@event.IsActionPressed("walk-right")) { + GD.Print("Hello!"); + Walk(Vector2I.Right); + } + + if (@event.IsActionPressed("skip-turn")) { + SkipTurn(); + } + } + } + + private void SkipTurn() { + GD.Print("Skipped the turn."); + Energy = 0; + EndAction(); + } + + protected override void EndAction() { + canAct = false; + base.EndAction(); + } + + public override void performAction() { + GD.Print("I can act"); + canAct = true; + } +} |
