using Godot;
/// Class InputHandler holds static methods
/// for handling player input.
public static class InputHandler
{
/// method MovementInput returns a Vector2 based on player input.
public static Vector2 MovementInput()
{
Vector2 movement = new Vector2();
if(Input.IsActionJustPressed("move_up"))
{
movement.y -= 1;
}
if(Input.IsActionJustPressed("move_down"))
{
movement.y += 1;
}
if(Input.IsActionJustPressed("move_right"))
{
movement.x += 1;
}
if(Input.IsActionJustPressed("move_left"))
{
movement.x -= 1;
}
return movement;
}
/// method DebugKeyInput returns bool when debug key is pressed in a debug build.
public static bool DebugKeyInput()
{
if(OS.IsDebugBuild())
return Input.IsActionJustPressed("debug_general");
return false;
}
}