FlxActions
Maps logical actions to keyboard, pointer, and gamepad sources.
The legacy bind(action, ...keys) helper remains a keyboard-only shorthand.
export declare class FlxActionsMethods
addSource()
addSource(action: string, source: FlxActionSource, options?: FlxActionRebindOptions): voidAdd one source without replacing the action's existing sources.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
source | FlxActionSource | - |
options | FlxActionRebindOptions | - |
Returns: void
bind()
bind(action: string, ...keys: string[]): voidReplace an action with one or more keyboard bindings.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
keys | string[] | - |
Returns: void
bindSources()
bindSources(action: string, ...sources: readonly FlxActionSource[]): voidReplace every source assigned to an action.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
sources | readonly FlxActionSource[] | - |
Returns: void
getSources()
getSources(action: string): readonly FlxActionSource[]Return defensive copies of an action's sources.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: readonly FlxActionSource[]
justPressed()
justPressed(action: string): booleanReturns true if any digital source was pressed on this simulation step.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: boolean
justReleased()
justReleased(action: string): booleanReturns true if any digital source was released on this simulation step.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: boolean
load()
load(data: FlxActionBindingsData | string): voidLoad bindings from a versioned object or JSON string.
Parameters:
| Parameter | Type | Description |
|---|---|---|
data | FlxActionBindingsData | string | - |
Returns: void
pressed()
pressed(action: string): booleanReturns true if any digital source is currently pressed.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: boolean
rebind()
rebind(action: string, source: FlxActionSource, options?: FlxActionRebindOptions): voidReplace an action with one source and, by default, remove that exact source from every other action.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
source | FlxActionSource | - |
options | FlxActionRebindOptions | - |
Returns: void
removeSource()
removeSource(action: string, source: FlxActionSource): booleanRemove one exact source from an action.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
source | FlxActionSource | - |
Returns: boolean
reset()
reset(): voidClear all action bindings.
Returns: void
save()
save(): FlxActionBindingsDataExport a versioned, JSON-safe binding object.
Returns: FlxActionBindingsData
unbind()
unbind(action: string): voidUnbind an action name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: void
value()
value(action: string): numberReturns the strongest scalar analog source by absolute magnitude. Digital sources do not contribute to this value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
action | string | - |
Returns: number