Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides access to keyboard inputs.

Hierarchy

  • KeyControls

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

action

  • get action(): boolean
  • set action(value: boolean): void

actionB

  • get actionB(): boolean

x

  • get x(): number
  • Gets x axis input direction.

    Checks left arrow or A key for left, and right arrow or D key for down.

    Returns number

y

  • get y(): number
  • Gets y axis input direction.

    Checks up arrow or W key for up, and down arrow or S key for down.

    Returns number

Methods

key

  • key(key: string, value?: boolean): boolean
  • Gets or sets the value of a key.

    Parameters

    • key: string

      KeyboardEvent code for the key (e.g. 'KeyW' for W).

    • Optional value: boolean

      If provided, sets the key's value.

    Returns boolean

    Whether or not key is 'pressed'.

reset

  • reset(): void