Skip to content
Eloy Villasclaras edited this page Apr 13, 2016 · 1 revision

<input> configures the game input. It must be a child of <game>, and there must be at most one <input> node.

Properties

Property Notes
pointers Number of input pointers (default: 2)
onDown Callback for the onDown event. Receives two parameters:
  1. pointer: the pointer object that caused the event
  2. context: shared context for react-phaser callbacks
onUp Callback for the onUp event. Receives two parameters:
  1. pointer: the pointer object
  2. context: shared context
onTap Callback for the onTap event. Receives two parameters:
  1. pointer: the pointer object
  2. context: shared context
onHold Callback for the onHold event. Receives two parameters:
  1. pointer: the pointer object
  2. context: shared context
keys An object mapping key names to Phaser key codes. E.g.:{p:Phaser.KeyCode.P}. The mapped keys are added to Phaser's keyboard input
cursors If true, adds cursors to Phaser's keyboard input
onInput A callback function invoked during the game update method. It receives the shared context¬

In addition to the keys property, <input> nodes can have <key> children, which allow to define key-specific event listeners.

Clone this wiki locally