class FlxActionDigital
package flixel.input.actions
extends FlxAction
import flixel.input.actions.FlxAction
A digital action is a binary on/off event like "jump" or "fire". FlxActions let you attach multiple inputs to a single in-game action, so "jump" could be performed by a keyboard press, a mouse click, or a gamepad button press.
4.6.0
.Constructor
new(Name:String = "", ?Callback:FlxActionDigital ‑> Void)
Create a new digital action
Parameters:
Name | name of the action |
---|---|
Callback | function to call when this action occurs |
Variables
Methods
add(input:FlxActionInputDigital):FlxActionDigital
Add a digital input (any kind) that will trigger this action
Parameters:
input |
---|
Returns:
This action
addGamepad(InputID:FlxGamepadInputID, Trigger:FlxInputState, GamepadID:Int = FlxInputDeviceID.FIRST_ACTIVE):FlxActionDigital
Add a gamepad action input for digital (button-like) events
Parameters:
InputID | "universal" gamepad input ID (A, X, DPAD_LEFT, etc) |
---|---|
Trigger | What state triggers this action (PRESSED, JUST_PRESSED, RELEASED, JUST_RELEASED) |
GamepadID | specific gamepad ID, or FlxInputDeviceID.ALL / FIRST_ACTIVE |
Returns:
This action
addInput(Input:IFlxInput, Trigger:FlxInputState):FlxActionDigital
Add a generic IFlxInput action input
WARNING: IFlxInput objects are often member variables of some other object that is often destructed at the end of a state. If you don't destroy() this input (or the action you assign it to), the IFlxInput reference will persist forever even after its parent object has been destroyed!
Parameters:
Input | A generic IFlxInput object (ex: FlxButton.input) |
---|---|
Trigger | Trigger What state triggers this action (PRESSED, JUST_PRESSED, RELEASED, JUST_RELEASED) |
Returns:
This action
addKey(Key:FlxKey, Trigger:FlxInputState):FlxActionDigital
Add a keyboard action input
Parameters:
Key | Key identifier (FlxKey.SPACE, FlxKey.Z, etc) |
---|---|
Trigger | What state triggers this action (PRESSED, JUST_PRESSED, RELEASED, JUST_RELEASED) |
Returns:
This action
addMouse(ButtonID:FlxMouseButtonID, Trigger:FlxInputState):FlxActionDigital
Mouse button action input
Parameters:
ButtonID | Button identifier (FlxMouseButtonID.LEFT / MIDDLE / RIGHT) |
---|---|
Trigger | What state triggers this action (PRESSED, JUST_PRESSED, RELEASED, JUST_RELEASED) |
Returns:
This action
addMouseWheel(Positive:Bool, Trigger:FlxInputState):FlxActionDigital
Action for mouse wheel events
Parameters:
Positive | True: respond to mouse wheel values > 0; False: respond to mouse wheel values < 0 |
---|---|
Trigger | What state triggers this action (PRESSED, JUST_PRESSED, RELEASED, JUST_RELEASED) |
Returns:
This action