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 browser
and cause the default browser behavior.

Pass in either a single keycode or an array/hash of keycodes.

Parameters
Name Type Description
keycode integer | Array.<integer> | object

Either a single keycode or an array/hash of keycodes such as [65, 67, 68].

Source code: input/Keyboard.js (Line 294)
doc_phaser
2017-02-14 10:53:46
Comments
Leave a Comment

Please login to continue.