summaryrefslogtreecommitdiff
path: root/scripts/InputHandler.cs
blob: dae990a08320c6fb527765dd6dc93b0e14263336 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
	}
}