summaryrefslogtreecommitdiff
path: root/scripts/InputHandler.cs
diff options
context:
space:
mode:
authorMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 19:32:36 -0300
committerMatheus <matheus.guedes.mg.m@gmail.com>2025-08-17 19:32:36 -0300
commitca782d7310f2df854a8727535ac92337c85ed445 (patch)
tree7df571c01d48cac56fb8362d4d091bdd2a55c09a /scripts/InputHandler.cs
parentadb86dd1725276457c13e9a4d37372fda628dea3 (diff)
Gigantesco refactor
Diffstat (limited to 'scripts/InputHandler.cs')
-rw-r--r--scripts/InputHandler.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/InputHandler.cs b/scripts/InputHandler.cs
new file mode 100644
index 0000000..dae990a
--- /dev/null
+++ b/scripts/InputHandler.cs
@@ -0,0 +1,22 @@
+using Godot;
+using System;
+
+public partial class InputHandler : Node {
+ public Action GetAction() {
+ Action action = null;
+
+ if (Input.IsActionJustPressed("walk-up")) {
+ action = new MovementAction(Vector2I.Up);
+ } else if (Input.IsActionJustPressed("walk-down")) {
+ action = new MovementAction(Vector2I.Down);
+ } else if (Input.IsActionJustPressed("walk-left")) {
+ action = new MovementAction(Vector2I.Left);
+ } else if (Input.IsActionJustPressed("walk-right")) {
+ action = new MovementAction(Vector2I.Right);
+ } else if (Input.IsActionJustPressed("skip-turn")) {
+ action = new MovementAction(Vector2I.Zero);
+ }
+
+ return action;
+ }
+}