Keyboard#enabled

enabled : boolean Keyboard input will only be processed if enabled. Default Value true Source code: input/Keyboard.js (Line 33)

Keyboard#downDuration()

downDuration(keycode, duration) → {boolean} Returns true if the Key was pressed down within the duration value given, or false if it either isn't down,or was pressed down longer ago than then given duration. Parameters Name Type Argument Default Description keycode integer The keycode of the key to check: i.e. Phaser.KeyCode.UP or Phaser.KeyCode.SPACEBAR. duration number <optional> 50 The duration within which the key is considered as being just pressed. Given in ms. Retur

Keyboard#destroy()

destroy() Stops the Keyboard event listeners from running (keydown and keyup). They are removed from the window.Also clears all key captures and currently created Key objects. Source code: input/Keyboard.js (Line 277)

Keyboard#createCursorKeys()

createCursorKeys() → {object} Creates and returns an object containing 4 hotkeys for Up, Down, Left and Right. Returns object - An object containing properties: up, down, left and right of Phaser.Key objects. Source code: input/Keyboard.js (Line 208)

Keyboard#clearCaptures()

clearCaptures() Clear all set key captures. Source code: input/Keyboard.js (Line 333)

Keyboard#callbackContext

callbackContext : Object The context under which the callbacks are run. Source code: input/Keyboard.js (Line 48)

Keyboard#addKeys()

addKeys(keys) → {object} A practical way to create an object containing user selected hotkeys. For example, addKeys( { 'up': Phaser.KeyCode.W, 'down': Phaser.KeyCode.S, 'left': Phaser.KeyCode.A, 'right': Phaser.KeyCode.D } ); would return an object containing properties (up, down, left and right) referring to Phaser.Key object. Parameters Name Type Description keys object A key mapping object, i.e. { 'up': Phaser.KeyCode.W, 'down': Phaser.KeyCode.S } or { 'up': 52, 'down': 53 }. Returns

Keyboard#addKeyCapture()

addKeyCapture(keycode) By default when a key is pressed Phaser will not stop the event from propagating up to the browser.There are some keys this can be annoying for, like the arrow keys or space bar, which make the browser window scroll. The addKeyCapture method enables consuming keyboard event for specific keys so it doesn't bubble up to the the browserand cause the default browser behavior. Pass in either a single keycode or an array/hash of keycodes. Parameters Name Type Description key

Keyboard#addKey()

addKey(keycode) → {Phaser.Key} If you need more fine-grained control over a Key you can create a new Phaser.Key object via this method.The Key object can then be polled, have events attached to it, etc. Parameters Name Type Description keycode integer The keycode of the key. Returns Phaser.Key - The Key object which you can store locally and reference directly. Source code: input/Keyboard.js (Line 144)

Keyboard#addCallbacks()

addCallbacks(context, onDown, onUp, onPress) Add callbacks to the Keyboard handler so that each time a key is pressed down or released the callbacks are activated. Parameters Name Type Argument Default Description context object The context under which the callbacks are run. onDown function <optional> null This callback is invoked every time a key is pressed down. onUp function <optional> null This callback is invoked every time a key is released. onPress functio