Skip to content
ClassInput & Controls@public

FlxVirtualStick

Texture-free HUD analog stick derived from authoritative fixed-step pointer state.

ts
export declare class FlxVirtualStick extends FlxSprite implements FlxVirtualStickState

Constructors

ts
constructor(id: string, x: number, y: number, options?: FlxVirtualStickOptions)

Constructs a new instance of the FlxVirtualStick class

ParameterTypeDescription
idstring-
xnumber-
ynumber-
optionsFlxVirtualStickOptions-

Properties

PropertyModifiersTypeDescription
baseColor-number-
deadZonereadonlynumber-
knobColor-number-
knobRadiusreadonlynumber-
outlineColor-number-
pressedreadonlyboolean-
pressedKnobColor-number-
radiusreadonlynumber-
rawXreadonlynumberClamped pre-dead-zone horizontal displacement used by the renderer.
rawYreadonlynumberClamped pre-dead-zone vertical displacement used by the renderer.
virtualInputIdreadonlystring-
xAxisreadonlynumberDead-zone-adjusted horizontal value in [-1, 1].
yAxisreadonlynumberDead-zone-adjusted vertical value in [-1, 1].

Methods

bindAxes()

ts
bindAxes(actions: FlxActions, map: FlxVirtualStickAxisMap): this

Add both available axes to an existing keyboard/gamepad action map.

Parameters:

ParameterTypeDescription
actionsFlxActions-
mapFlxVirtualStickAxisMap-

Returns: this

createRenderHandle()

ts
createRenderHandle(): FlxVirtualStickRenderHandle

Returns: FlxVirtualStickRenderHandle

destroy()

ts
destroy(): void

Returns: void

source()

ts
source(axis: 'x' | 'y'): FlxActionVirtualStickAxisSource

Create a serializable scalar action source for one axis.

Parameters:

ParameterTypeDescription
axis'x' | 'y'-

Returns: FlxActionVirtualStickAxisSource

update()

ts
update(): void

Returns: void

Released under the MIT License.