Interface: KeyboardPluginEventsMap

Phaser.Types.Input.Keyboard. KeyboardPluginEventsMap

Methods


keycombomatch(keycombo, event)

The Key Combo Match Event.

This event is dispatched by the Keyboard Plugin when a Key Combo is matched.

Listen for this event from the Key Plugin after a combo has been created:

this.input.keyboard.createCombo([ 38, 38, 40, 40, 37, 39, 37, 39, 66, 65, 13 ], { resetOnMatch: true });

this.input.keyboard.on('keycombomatch', function (event) {
    console.log('Konami Code entered!');
});
Parameters:
Name Type Description
keycombo Phaser.Input.Keyboard.KeyCombo

The Key Combo object that was matched.

event KeyboardEvent

The native DOM Keyboard Event of the final key in the combo. You can inspect this to learn more about any modifiers, etc.

Since: 3.0.0
Source: src/input/keyboard/events/COMBO_MATCH_EVENT.js (Line 30)

keydown(event)

The Global Key Down Event.

This event is dispatched by the Keyboard Plugin when any key on the keyboard is pressed down.

Listen to this event from within a Scene using: this.input.keyboard.on('keydown', listener).

You can also listen for a specific key being pressed. See Keyboard.Events.KEY_DOWN for details.

Finally, you can create Key objects, which you can also listen for events from. See Keyboard.Events.DOWN for details.

Note: Many keyboards are unable to process certain combinations of keys due to hardware limitations known as ghosting. Read this article on ghosting for details.

Also, please be aware that some browser extensions can disable or override Phaser keyboard handling. For example, the Chrome extension vimium is known to disable Phaser from using the D key, while EverNote disables the backtick key. There are others. So, please check your extensions if you find you have specific keys that don't work.

Parameters:
Name Type Description
event KeyboardEvent

The native DOM Keyboard Event. You can inspect this to learn more about the key that was pressed, any modifiers, etc.

Since: 3.0.0
Source: src/input/keyboard/events/ANY_KEY_DOWN_EVENT.js (Line 32)

keyup(event)

The Global Key Up Event.

This event is dispatched by the Keyboard Plugin when any key on the keyboard is released.

Listen to this event from within a Scene using: this.input.keyboard.on('keyup', listener).

You can also listen for a specific key being released. See Keyboard.Events.KEY_UP for details.

Finally, you can create Key objects, which you can also listen for events from. See Keyboard.Events.UP for details.

Parameters:
Name Type Description
event KeyboardEvent

The native DOM Keyboard Event. You can inspect this to learn more about the key that was released, any modifiers, etc.

Since: 3.0.0
Source: src/input/keyboard/events/ANY_KEY_UP_EVENT.js (Line 25)