Controller

Respond to game controller buttons.

Controller buttons have key assignments when an Arcade game is played on a device with a keyboard. On a keyboard that has the QWERTY format, the keys assigned to controller buttons for a single player are shown in the diagram for Player #1. When two players are using the same device, the keys labeled for Player #2 are used.

Keyboard to button key assignments

Single player

controller.A.onEvent(ControllerButtonEvent.Pressed, function () {})
controller.A.isPressed()
controller.moveSprite(null, 0, 0)
controller.dx(100)
controller.dy(100)

Multiplayer

controller.player2.onButtonEvent(ControllerButton.A, ControllerButtonEvent.Pressed, function () {})
controller.player2.moveSprite(null)
controller.player2.onEvent(ControllerEvent.Connected, function () {})
controller.player2.isPressed(ControllerButton.A)
controller.player2.dx()
controller.player2.dy()

Configuration

See also

on event, is pressed, on button event, move sprite, dx, dy