summaryrefslogtreecommitdiff
path: root/scripts/Character.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-16 15:56:28 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-16 15:56:28 -0300
commitb05cfd5577884d1a398dbb226e2082af5fe8f8fa (patch)
tree26961e5c63e87c5d1c17422cdf6ab4493b2d8f55 /scripts/Character.cs
parentc411c496394c7a782854e03f2be8fab4cc1e2a81 (diff)
Sistema de turnos básico
Diffstat (limited to 'scripts/Character.cs')
-rw-r--r--scripts/Character.cs50
1 files changed, 35 insertions, 15 deletions
diff --git a/scripts/Character.cs b/scripts/Character.cs
index e3707f5..172ffe4 100644
--- a/scripts/Character.cs
+++ b/scripts/Character.cs
@@ -2,6 +2,7 @@ using Godot;
using System;
public partial class Character : Actor {
+ private bool canAct = false;
public override void _Input(InputEvent @event)
{
@@ -9,23 +10,42 @@ public partial class Character : Actor {
if (!@event.IsPressed()) return;
- Vector2I offset = Vector2I.Zero;
+ if (canAct) {
+
- if (@event.IsActionPressed("walk-up")) {
- offset += Vector2I.Up;
- }
- if (@event.IsActionPressed("walk-down")) {
- offset += Vector2I.Down;
- }
- if (@event.IsActionPressed("walk-left")) {
- offset += Vector2I.Left;
- }
- if (@event.IsActionPressed("walk-right")) {
- offset += Vector2I.Right;
- }
+ 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 (offset != Vector2I.Zero) {
- Walk(offset);
+ 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;
+ }
}