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: Settrueto reset the combo when press the wrong key.maxKeyDelay: The max delay in ms between each key press. Set0to disable this feature.resetOnMatch: Settrueto reset the combo when previously matched.deleteOnMatch: Settrueto delete this combo when matched.
- Listen combo matching event
scene.input.keyboard.on('keycombomatch', function (keyCombo, keyboardEvent) { /* ... */ });