Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KeyControls

Mouse controls

Hierarchy

  • KeyControls

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

actionList

actionList: KeyAction[] = []

disabled

disabled: boolean

stage

stage: Stage

the stage object

Methods

add

  • Add a key action triggered by pressing the given character. The KeyActions class provides a number of static methods for use as callback functions.

    example

    // call KeyActions.toggleRock when "k" is pressed stage.keyControls.remove( "k", KeyActions.toggleRock );

    Parameters

    • char: string

      the key/character

    • callback: KeyActionCallback

      the callback function for the action

    Returns void

clear

  • clear(): void

preset

remove

  • Remove a key action. When the callback function is given, only actions that call that function are removed.

    example

    // remove all actions triggered by pressing "k" stage.keyControls.remove( "k" );

    example

    // remove action toggleRock triggered by pressing "k" stage.keyControls.remove( "k", toggleRock );

    Parameters

    Returns void

run

  • run(key: string): void

Generated using TypeDoc