Module controller

An interface for receiving input from the player.

Use get_controller to obtain controller instances that receive data from the game engine.

Controller extends BoundObject

Properties

up (bool) (read only) Up direction is pressed.
down (bool) (read only) Down direction is pressed.
left (bool) (read only) Left direction is pressed.
right (bool) (read only) Right direction is pressed.
a_button (bool) (read only) A button is pressed.
pressed A table describing which buttons were pressed down on the current frame.
released A table describing which buttons were released on the current frame.

Global Functions

get_controller (i) Obtain a controller instance that is registered to receive data from the game engine.


Properties

Properties. Significant fields on an instance.
up
(bool) (read only) Up direction is pressed.
down
(bool) (read only) Down direction is pressed.
left
(bool) (read only) Left direction is pressed.
right
(bool) (read only) Right direction is pressed.
a_button
(bool) (read only) A button is pressed.
pressed
A table describing which buttons were pressed down on the current frame. For example, controller.pressed.up
released
A table describing which buttons were released on the current frame. For example, controller.released.up

Global Functions

Global Functions.
get_controller (i)
Obtain a controller instance that is registered to receive data from the game engine.

Parameters:

  • i number Which controller slot to grab. Currently supports 1 - 4

Returns:

    `Controller` the registered instance
generated by LDoc 1.3.12