adde compound command calling for multi input control; added notes on dot product; testing stuff in skunk works folder
This commit is contained in:
@@ -1,28 +1,42 @@
|
||||
class_name Player extends Node
|
||||
|
||||
|
||||
func process(_delta: float) -> Globals.ControllerCommand:
|
||||
var commands: Globals.CompoundCommand = Globals.CompoundCommand.new()
|
||||
|
||||
|
||||
func process(_delta: float) -> Globals.CompoundCommand:
|
||||
no_action()
|
||||
|
||||
if Input.is_action_pressed("pitch_up"):
|
||||
return Globals.ControllerCommand.PITCH_UP
|
||||
if Input.is_action_pressed("pitch_down"):
|
||||
return Globals.ControllerCommand.PITCH_DOWN
|
||||
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"):
|
||||
return Globals.ControllerCommand.YAW_LEFT
|
||||
if Input.is_action_pressed("yaw_right"):
|
||||
return Globals.ControllerCommand.YAW_RIGHT
|
||||
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"):
|
||||
return Globals.ControllerCommand.ROLL_LEFT
|
||||
if Input.is_action_pressed("roll_right"):
|
||||
return Globals.ControllerCommand.ROLL_RIGHT
|
||||
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"):
|
||||
return Globals.ControllerCommand.THROTTLE_UP
|
||||
if Input.is_action_pressed("throttle_down"):
|
||||
return Globals.ControllerCommand.THROTTLE_DOWN
|
||||
commands.THROTTLE = Globals.ControllerCommand.THROTTLE_UP
|
||||
elif Input.is_action_pressed("throttle_down"):
|
||||
commands.THROTTLE = Globals.ControllerCommand.THROTTLE_DOWN
|
||||
|
||||
return Globals.ControllerCommand.NONE
|
||||
return commands
|
||||
|
||||
func physics_process(_delta: float) -> Globals.ControllerCommand:
|
||||
return Globals.ControllerCommand.NONE
|
||||
func physics_process(_delta: float) -> Globals.CompoundCommand:
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func unhandled_input(_event: InputEvent) -> Globals.ControllerCommand:
|
||||
return Globals.ControllerCommand.NONE
|
||||
func unhandled_input(_event: InputEvent) -> Globals.CompoundCommand:
|
||||
return Globals.CompoundCommand.new()
|
||||
|
||||
func no_action() -> void:
|
||||
commands.PITCH = Globals.ControllerCommand.NONE
|
||||
commands.YAW = Globals.ControllerCommand.NONE
|
||||
commands.ROLL = Globals.ControllerCommand.NONE
|
||||
commands.THROTTLE = Globals.ControllerCommand.NONE
|
||||
|
||||
Reference in New Issue
Block a user