Basic FunctionalityInput ManagementTriggerOn this pageTrigger Description: Trigger is a record that defines various input triggers for keyboard keys, gamepad buttons, and joysticks. state Type: Field. Description: The current trigger state. Signature: state: TriggerState value Type: Field. Description: The current trigger value. Signature: value: InputValue progress Type: Field. Description: The current trigger progress, from 0 to 1 when applicable. Signature: progress: number onChange Type: Function. Description: Legacy single change callback. Prefer addListener() for multiple listeners. Signature: onChange: function() addListener Type: Function. Description: Adds a listener without replacing existing listeners. Signature: addListener: function(self: Trigger, listener: TriggerListener) removeListener Type: Function. Description: Removes a listener added by addListener(). Signature: removeListener: function(self: Trigger, listener: TriggerListener) Down Type: Function. Description: Create a key or button down trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Down: function(input: InputBinding): Trigger Parameters: ParameterTypeDescriptioninputInputBindingThe input binding. Returns: Return TypeDescriptionTriggerThe trigger object. Down Type: Function. Description: Create a key or button down trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Down: function(input: {InputBinding}): Trigger Parameters: ParameterTypeDescriptioninput{InputBinding}The input bindings. Returns: Return TypeDescriptionTriggerThe trigger object. Up Type: Function. Description: Create a key or button up trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Up: function(input: InputBinding): Trigger Parameters: ParameterTypeDescriptioninputInputBindingThe input binding. Returns: Return TypeDescriptionTriggerThe trigger object. Up Type: Function. Description: Create a key or button up trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Up: function(input: {InputBinding}): Trigger Parameters: ParameterTypeDescriptioninput{InputBinding}The input bindings. Returns: Return TypeDescriptionTriggerThe trigger object. Pressed Type: Function. Description: Create a key or button pressed trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Pressed: function(input: InputBinding): Trigger Parameters: ParameterTypeDescriptioninputInputBindingThe input binding. Returns: Return TypeDescriptionTriggerThe trigger object. Pressed Type: Function. Description: Create a key or button pressed trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Pressed: function(input: {InputBinding}): Trigger Parameters: ParameterTypeDescriptioninput{InputBinding}The input bindings. Returns: Return TypeDescriptionTriggerThe trigger object. Hold Type: Function. Description: Create a key or button hold trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Hold: function(input: InputBinding, holdTime: number): Trigger Parameters: ParameterTypeDescriptioninputInputBindingThe input binding.holdTimenumberThe duration in seconds. Returns: Return TypeDescriptionTriggerThe trigger object. Hold Type: Function. Description: Create a key or button hold trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Hold: function(input: {InputBinding}, holdTime: number): Trigger Parameters: ParameterTypeDescriptioninput{InputBinding}The input bindings.holdTimenumberThe duration in seconds. Returns: Return TypeDescriptionTriggerThe trigger object. Double Type: Function. Description: Create a key or button double-press trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Double: function(input: InputBinding, threshold?: number): Trigger Parameters: ParameterTypeDescriptioninputInputBindingThe input binding.thresholdnumber[optional] The time window in seconds. Default is 0.3. Returns: Return TypeDescriptionTriggerThe trigger object. Double Type: Function. Description: Create a key or button double-press trigger. Pass multiple bindings to trigger when any binding is completed. Signature: Double: function(input: {InputBinding}, threshold?: number): Trigger Parameters: ParameterTypeDescriptioninput{InputBinding}The input bindings.thresholdnumber[optional] The time window in seconds. Default is 0.3. Returns: Return TypeDescriptionTriggerThe trigger object. KeyDown Type: Function. Description: Create a trigger that triggers when all of the specified keys are pressed down. Signature: KeyDown: function(combineKeys: KeyName | {KeyName}): Trigger Parameters: ParameterTypeDescriptioncombineKeysKeyName{KeyName} Returns: Return TypeDescriptionTriggerThe trigger object. KeyUp Type: Function. Description: Create a trigger that triggers when all of the specified keys are pressed down and then any of them is released. Signature: KeyUp: function(combineKeys: KeyName | {KeyName}): Trigger Parameters: ParameterTypeDescriptioncombineKeysKeyName{KeyName} Returns: Return TypeDescriptionTriggerThe trigger object. KeyPressed Type: Function. Description: Create a trigger that triggers when all of the specified keys are being pressed. Signature: KeyPressed: function(combineKeys: KeyName | {KeyName}): Trigger Parameters: ParameterTypeDescriptioncombineKeysKeyName{KeyName} Returns: Return TypeDescriptionTriggerThe trigger object. KeyHold Type: Function. Description: Create a trigger that triggers when a specific key is held down for a specified duration. Signature: KeyHold: function(keyName: KeyName, holdTime: number): Trigger Parameters: ParameterTypeDescriptionkeyNameKeyNameThe key to be checked.holdTimenumberThe duration in seconds. Returns: Return TypeDescriptionTriggerThe trigger object. KeyTimed Type: Function. Description: Create a trigger that triggers when a specific key is pressed within a specified time window. Signature: KeyTimed: function(keyName: KeyName, timeWindow: number): Trigger Parameters: ParameterTypeDescriptionkeyNameKeyNameThe key to be checked.timeWindownumberThe time window in seconds. Returns: Return TypeDescriptionTriggerThe trigger object. KeyDoubleDown Type: Function. Description: Create a trigger that triggers when a specific key is double-pressed within a specified time window. Signature: KeyDoubleDown: function(key: KeyName, threshold?: number): Trigger Parameters: ParameterTypeDescriptionkeyKeyNameThe key to be checked.thresholdnumber[optional] The time window in seconds. Default is 0.3. Returns: Return TypeDescriptionTriggerThe trigger object. AnyKeyPressed Type: Function. Description: Create a trigger that triggers when any key is being pressed down. Signature: AnyKeyPressed: function(): Trigger Returns: Return TypeDescriptionTriggerThe trigger object. ButtonDown Type: Function. Description: Create a trigger that triggers when all of the specified gamepad buttons are pressed down. Signature: ButtonDown: function(combineButtons: ButtonName | {ButtonName}, controllerId?: number): Trigger Parameters: ParameterTypeDescriptioncombineButtonsButtonName{ButtonName}controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. ButtonUp Type: Function. Description: Create a trigger that triggers when all of the specified gamepad buttons are pressed down and then any of them is released. Signature: ButtonUp: function(combineButtons: ButtonName | {ButtonName}, controllerId?: number): Trigger Parameters: ParameterTypeDescriptioncombineButtonsButtonName{ButtonName}controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. ButtonPressed Type: Function. Description: Create a trigger that triggers when all of the specified gamepad buttons are being pressed. Signature: ButtonPressed: function(combineButtons: ButtonName | {ButtonName}, controllerId?: number): Trigger Parameters: ParameterTypeDescriptioncombineButtonsButtonName{ButtonName}controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. ButtonHold Type: Function. Description: Create a trigger that triggers when a specific gamepad button is held down for a specified duration. Signature: ButtonHold: function(buttonName: ButtonName, holdTime: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionbuttonNameButtonNameThe gamepad button to be checked.holdTimenumberThe duration in seconds.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. ButtonTimed Type: Function. Description: Create a trigger that triggers when a specific gamepad button is pressed within a specified time window. Signature: ButtonTimed: function(buttonName: ButtonName, timeWindow: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionbuttonNameButtonNameThe gamepad button to be checked.timeWindownumberThe time window in seconds.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. ButtonDoubleDown Type: Function. Description: Create a trigger that triggers when a specific gamepad button is double-pressed within a specified time window. Signature: ButtonDoubleDown: function(button: ButtonName, threshold?: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionbuttonButtonNameThe gamepad button to be checked.thresholdnumber[optional] The time window in seconds. Default is 0.3.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. AnyButtonPressed Type: Function. Description: Create a trigger that triggers when any gamepad button is being pressed down. Signature: AnyButtonPressed: function(controllerId?: number): Trigger Parameters: ParameterTypeDescriptioncontrollerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. JoyStick Type: Function. Description: Create a trigger that triggers based on joystick movement. Signature: JoyStick: function(joyStickType: JoyStickType, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionjoyStickTypeJoyStickTypeThe type of joystick to be checked.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. JoyStickThreshold Type: Function. Description: Create a trigger that triggers when a joystick moves beyond a specified threshold. Signature: JoyStickThreshold: function(joyStickType: JoyStickType, threshold: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionjoyStickTypeJoyStickTypeThe type of joystick to be checked.thresholdnumberThe threshold value, ranging from 0 to 1.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. JoyStickDirectional Type: Function. Description: Create a trigger that triggers when a joystick is moved in a specific direction within a tolerance angle. Signature: JoyStickDirectional: function(joyStickType: JoyStickType, angle: number, tolerance: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionjoyStickTypeJoyStickTypeThe type of joystick to be checked.anglenumberThe angle of the direction in degrees.tolerancenumberThe tolerance angle in degrees.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. JoyStickRange Type: Function. Description: Create a trigger that triggers when a joystick is within a specified range. Signature: JoyStickRange: function(joyStickType: JoyStickType, minRange: number, maxRange: number, controllerId?: number): Trigger Parameters: ParameterTypeDescriptionjoyStickTypeJoyStickTypeThe type of joystick to be checked.minRangenumberThe minimum range value, ranging from 0 to 1.maxRangenumberThe maximum range value, ranging from 0 to 1.controllerIdnumber[optional] The ID of the gamepad controller. Default is 0. Returns: Return TypeDescriptionTriggerThe trigger object. Sequence Type: Function. Description: Create a trigger that triggers when a sequence of other triggers are completed at the same time. Signature: Sequence: function(triggers: {Trigger}): Trigger Parameters: ParameterTypeDescriptiontriggers{Trigger}The triggers to be checked. Returns: Return TypeDescriptionTriggerThe trigger object. Selector Type: Function. Description: Create a trigger that triggers when any of the specified triggers is completed. Signature: Selector: function(triggers: {Trigger}): Trigger Parameters: ParameterTypeDescriptiontriggers{Trigger}The triggers to be checked. Returns: Return TypeDescriptionTriggerThe trigger object. Block Type: Function. Description: Create a trigger when a sub-trigger is in completed state, it will report canceled state instead for blocking. Signature: Block: function(trigger: Trigger): Trigger Parameters: ParameterTypeDescriptiontriggerTriggerThe trigger to be blocked. Returns: Return TypeDescriptionTriggerThe trigger object.