Class Input

Classdesc

Input class, used for handling input

Example

const input = new Input("w", 100);
input.on = (event) => {
console.log("w pressed");
}
input.activate(scene);

Constructors

  • Parameters

    • key: string

      The key that the input is bound to ("click" is you want to monitor clicks)

    • fireRate: number

      How often the input fires (in ms)

    Returns Input

Properties

active: boolean

Whether or not the input is active

clickMonitor: boolean

Whether or not the input is a click monitor

fireInterval: any

Interval that the input fires on

fireRate: number

Fire rate of the input

firing: boolean

Whether or not the input is firing

id: string

Unique ID of the input

key: string

Key that the input is bound to

on: Function

Function to run when the input is fired (EventOnFunction)

Methods

  • Activates the input monitor

    Parameters

    • Optional activateOn: Scene

      Scene to activate the input on (Only matters if the input is a click monitor)

    Returns void

  • Temporarily deactivates the input monitor

    Returns void

  • Reactivates the input monitor (if it was deactivated- do not use input.active(scene) as this will cause the on function to be called twice every fireRate ms)

    Returns void

  • Starts firing the on function ever fireRate ms

    Parameters

    • e: Event

      Event to pass to the on function

    Returns void

  • Stops firing the on function

    Returns void

Generated using TypeDoc