Combo events
Introduction¶
Combo-keys events.
- Author: Richard Davey
Usage¶
- Create combo
var keyCombo = scene.input.keyboard.createCombo(keys, { // resetOnWrongKey: true, // maxKeyDelay: 0, // resetOnMatch: false, // deleteOnMatch: false, });
keys
: Array of keyCodes- In strings. ex:
['up', 'up', 'down', 'down']
, or['UP', 'UP', 'DOWN', 'DOWN']
- In key map. ex:
[Phaser.Input.Keyboard.KeyCodes.UP, ... ]
- In numbers. ex:
[38, 38, 40, 40]
- In strings. ex:
resetOnWrongKey
: Settrue
to reset the combo when press the wrong key.maxKeyDelay
: The max delay in ms between each key press. Set0
to disable this feature.resetOnMatch
: Settrue
to reset the combo when previously matched.deleteOnMatch
: Settrue
to delete this combo when matched.
- Listen combo matching event
scene.input.keyboard.on('keycombomatch', function (keyCombo, keyboardEvent) { /* ... */ });