Phaser API Documentation

  Version: 
Filter

Contains information about a specific button on a Gamepad. Button objects are created automatically by the Gamepad as they are needed.

Constructor:

new Button(pad, index)

Parameters:

name type description
pad Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Button belongs to.

index number

The index of this Button.

Since: 3.0.0

Members

Description:

An event emitter to use to emit the button events.

Type:
Since: 3.0.0
Focus
Focus
index: number
Focus
Focus

Description:

The index of this Button.

Type:
number
Since: 3.0.0
Focus
Focus

Description:

A reference to the Gamepad that this Button belongs to.

Type:
Since: 3.0.0
Focus
Focus
pressed: boolean
Focus
Focus

Description:

Is the Button being pressed down or not?

Type:
boolean
Default: false
Since: 3.0.0
Focus
Focus
threshold: number
Focus
Focus

Description:

Can be set for analogue buttons to enable a 'pressure' threshold, before a button is considered as being 'pressed'.

Type:
number
Default: 1
Since: 3.0.0
Focus
Focus
value: number
Focus
Focus

Description:

Between 0 and 1.

Type:
number
Default: 0
Since: 3.0.0
Focus
Focus

Methods

destroy()
Focus
Focus

Description:

Destroys this Button instance and releases external references it holds.

Since: 3.10.0
Focus
Focus
<private> update(value)
Focus
Focus

Description:

Internal update handler for this Button. Called automatically by the Gamepad as part of its update.

Parameters:

name type description
value number

The value of the button. Between 0 and 1.

Since: 3.0.0
Focus
Focus