This class allows to bind callbacks to gamepad buttons. For permanent bindings, set "persist" to true when adding controls. Permanent bindings are kept even if you call ControlManager.reset. Otherwise, set "persist" to false, then these controls will be disabled after ControlManager.reset is called.

Constructors

Properties

audio: Audio
current_set_key?: number

Key of the current binding set.

current_signal_bindings: SignalBinding[]

Current binding set, that will be reset upon demand.

disabled: boolean
game: Game
gamepad: Gamepad
loop_repeat_timer: Timer

Some timer

loop_start_timer: Timer

Some timer

signal_bindings: {
    [key: number]: Phaser.SignalBinding[];
}

Every currently listening signals (binding sets).

Type declaration

  • [key: number]: Phaser.SignalBinding[]

Accessors

Methods

  • Adds a list of controls to listen to, also adding them to a binding set.

    Parameters

    • controls: Control[]

      Some controls to add.

    • Optional params: ControlParams

      Some parameters for these controls.

    Returns number

  • Binds a callback for button A that will be unbound on use.

    Parameters

    • callback: Function

      The callback to call.

    • Optional params: SimpleControlParams

      Some parameters for these controls.

    Returns number

  • Handles the loop_config param

    Parameters

    • controls: Control[]

      Controls getting added

    • params: any

      Parameters to apply to these controls

    Returns void

  • Checks if a sequence of given buttons is down till the one before the last of the given list.

    Parameters

    • buttons: Button[]

      the sequence of buttons.

    Returns boolean

    returns whether the sequence of buttons till the one before the last is down.

  • Add a listener/event for the controls passed.

    Parameters

    • controls: Control[]

      Controls to listen for.

    • Optional persist: boolean

      Whether the controls have to persist.

    • Optional call_once: boolean

      Whether the controls will be called once.

    Returns number

  • Finds the next usable index of the persisting bindings. we could also simply use .length

    Returns number

    • A free usable index
  • Stops the loop timers and removes the current listeners.

    Parameters

    • detach: boolean = true

      Whether to removes the current listeners

    Returns void

  • Registers a new loop timer.

    Parameters

    • callback: Function

      Callback to call at each tick

    • loop_time: number

      Ticks length

    • sfx: string | (() => string)

      Sfx to play at each tick

    Returns void