InputDevice

InputDevice

new InputDevice()

Look at the Input reference pages before reading these docs. Root class for storing the state of inputs (mouse, keyboard, gamepads). -3 means input was pressed and released on the same frame -2 means input was released after being held -1 means input was released 0 means input is not pressed 1 means input was pressed >1 means input is still being pressed
Source:

Classes

InputDevice

Methods

held(inp) → {boolean}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
boolean
true on the first frame that the user released a held input

holding(inp) → {number}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
number
the amount of frames the user has been holding the input

holds(inp) → {boolean}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
boolean
true on the first frame that the user holds the input

pressed(inp) → {boolean}

Same as the `released` function, which is preferred.
Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
boolean
true on the first frame that the user released the input

presses(inp) → {boolean}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
boolean
true on the first frame that the user presses the input

pressing(inp) → {number}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
number
the amount of frames the user has been pressing the input

released(inp) → {boolean}

Source:
Parameters:
Name Type Description
inp string
Returns:
Type:
boolean
true on the first frame that the user released the input