Files
GrowlerFury/scripts/jet_controls/player.gd
T

37 lines
1.2 KiB
GDScript

class_name Player extends Node
var commands: Globals.CompoundCommand = Globals.CompoundCommand.new()
func process(_delta: float) -> Globals.CompoundCommand:
no_action()
if Input.is_action_pressed("pitch_up"):
commands.PITCH = Globals.ControllerCommand.PITCH_UP
elif Input.is_action_pressed("pitch_down"):
commands.PITCH = Globals.ControllerCommand.PITCH_DOWN
if Input.is_action_pressed("yaw_left"):
commands.YAW = Globals.ControllerCommand.YAW_LEFT
elif Input.is_action_pressed("yaw_right"):
commands.YAW = Globals.ControllerCommand.YAW_RIGHT
if Input.is_action_pressed("roll_left"):
commands.ROLL = Globals.ControllerCommand.ROLL_LEFT
elif Input.is_action_pressed("roll_right"):
commands.ROLL = Globals.ControllerCommand.ROLL_RIGHT
if Input.is_action_pressed("throttle_up"):
commands.THROTTLE = Globals.ControllerCommand.THROTTLE_UP
elif Input.is_action_pressed("throttle_down"):
commands.THROTTLE = Globals.ControllerCommand.THROTTLE_DOWN
return commands
func no_action() -> void:
commands.PITCH = Globals.ControllerCommand.NONE
commands.YAW = Globals.ControllerCommand.NONE
commands.ROLL = Globals.ControllerCommand.NONE
commands.THROTTLE = Globals.ControllerCommand.NONE