An FlxActionDigital with additional functionality, including: - Combining pressed and released inputs into one action. - Filtering by input method (KEYBOARD, MOUSE, GAMEPAD, etc).

Constructor

@:value({ name : "" })new(name:String = "", ?namePressed:String, ?nameReleased:String)

Variables

read onlynamePressed:Null<String>

read onlynameReleased:Null<String>

Methods

check():Bool

Input checks default to whether the input was just pressed, on any input device.

checkFiltered(?filterTrigger:FlxInputState, ?filterDevice:FlxInputDevice):Bool

Performs the functionality of FlxActionDigital.check(), but with optional filters.

Parameters:

action

The action to check for.

filterTrigger

Optionally filter by trigger condition (JUST_PRESSED, PRESSED, JUST_RELEASED, RELEASED).

filterDevice

Optionally filter by device (KEYBOARD, MOUSE, GAMEPAD, OTHER).

Returns:

bool if our input has been triggered

checkJustPressed():Bool

Check whether the input is currently being held, and was not held last frame.

checkJustPressedGamepad():Bool

Check whether the input is currently being held by a gamepad device, and was not held last frame.

checkJustReleased():Bool

Check whether the input is not currently being held, and was held last frame.

checkJustReleasedGamepad():Bool

Check whether the input is not currently being held by a gamepad device, and was held last frame.

checkMultiFiltered(?filterTriggers:Array<FlxInputState>, ?filterDevices:Array<FlxInputDevice>):Bool

checkPressed():Bool

Check whether the input is currently being held.

checkPressedGamepad():Bool

Check whether the input is currently being held by a gamepad device.

checkReleased():Bool

Check whether the input is not currently being held.

checkReleasedGamepad():Bool

Check whether the input is not currently being held by a gamepad device.

Inherited Variables

Defined by FlxActionDigital

callback:FlxActionDigital ‑> Void

Function to call when this action occurs

Defined by FlxAction

inputs:Array<FlxActionInput>

The inputs attached to this action

read onlyname:String

The name of the action, "jump", "fire", "move", etc.

@:value(false)read onlysteamOriginsChanged:Bool = false

Whether the steam controller inputs for this action have changed since the last time origins were polled. Always false if steam isn't active

@:value(false)read onlytriggered:Bool = false

If true, this action has just been triggered

read onlytype:FlxInputType

Digital or Analog

Inherited Methods

Defined by FlxActionDigital

add(input:FlxActionInputDigital):FlxActionDigital

Add a digital input (any kind) that will trigger this action

Parameters:

input

Returns:

This action

@:value({ GamepadID : FlxInputDeviceID.FIRST_ACTIVE })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

Defined by FlxAction

getSteamOrigins(?origins:Array<Int>):Array<Int>

match(other:FlxAction):Bool

@:value({ Destroy : false })remove(Input:FlxActionInput, Destroy:Bool = false):Void

@:value({ Destroy : true })removeAll(Destroy:Bool = true):Void

toString():String

update():Void

Check input states & fire callbacks if anything is triggered