Adds a Key object to this Keyboard Plugin.
The given argument can be either an existing Key object, a string, such as A
or SPACE
, or a key code value.
If a Key object is given, and one already exists matching the same key code, the existing one is replaced with the new one.
name | type | arguments | Default | description |
---|---|---|---|---|
key | string | number | Phaser.Input.Keyboard.Key |
Either a Key object, a string, such as |
||
enableCapture | boolean | <optional> | true |
Automatically call |
emitOnRepeat | boolean | <optional> | false |
Controls if the Key will continuously emit a 'down' event while being held down (true), or emit the event just once (false, the default). |
The newly created Key object, or a reference to it if it already existed in the keys array.