Trigger
Description:
Trigger
is a record that defines various input triggers for keyboard keys, gamepad buttons, and joysticks.
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:
Parameter | Type | Description |
---|---|---|
combineKeys | KeyName | {KeyName} |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
combineKeys | KeyName | {KeyName} |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
combineKeys | KeyName | {KeyName} |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
keyName | KeyName | The key to be checked. |
holdTime | number | The duration in seconds. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
keyName | KeyName | The key to be checked. |
timeWindow | number | The time window in seconds. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
key | KeyName | The key to be checked. |
threshold | number | [optional] The time window in seconds. Default is 0.3. |
Returns:
Return Type | Description |
---|---|
Trigger | The trigger object. |
AnyKeyPressed
Type: Function.
Description:
Create a trigger that triggers when any key is being pressed down.
Signature:
AnyKeyPressed: function(): Trigger
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
combineButtons | ButtonName | {ButtonName} |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
combineButtons | ButtonName | {ButtonName} |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
combineButtons | ButtonName | {ButtonName} |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
buttonName | ButtonName | The gamepad button to be checked. |
holdTime | number | The duration in seconds. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
buttonName | ButtonName | The gamepad button to be checked. |
timeWindow | number | The time window in seconds. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
button | ButtonName | The gamepad button to be checked. |
threshold | number | [optional] The time window in seconds. Default is 0.3. |
controllerId | number | [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:
Parameter | Type | Description |
---|---|---|
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The trigger object. |
JoyStick
Type: Function.
Description:
Create a trigger that triggers based on joystick movement.
Signature:
JoyStick: function(joyStickType: JoyStickType, controllerId?: number): Trigger
Parameters:
Parameter | Type | Description |
---|---|---|
joyStickType | JoyStickType | The type of joystick to be checked. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
joyStickType | JoyStickType | The type of joystick to be checked. |
threshold | number | The threshold value, ranging from 0 to 1. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
joyStickType | JoyStickType | The type of joystick to be checked. |
angle | number | The angle of the direction in degrees. |
tolerance | number | The tolerance angle in degrees. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
joyStickType | JoyStickType | The type of joystick to be checked. |
minRange | number | The minimum range value, ranging from 0 to 1. |
maxRange | number | The maximum range value, ranging from 0 to 1. |
controllerId | number | [optional] The ID of the gamepad controller. Default is 0. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
triggers | {Trigger} | The triggers to be checked. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
triggers | {Trigger} | The triggers to be checked. |
Returns:
Return Type | Description |
---|---|
Trigger | The 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:
Parameter | Type | Description |
---|---|---|
trigger | Trigger | The trigger to be blocked. |
Returns:
Return Type | Description |
---|---|
Trigger | The trigger object. |