A reference to the Keyboard Plugin.
The keys that comprise this combo.
Optionalconfig: KeyComboConfig
A Key Combo configuration object.
The current keyCode the combo is waiting for.
If the combo matches successfully, this KeyCombo instance will automatically destroy itself.
A flag that controls if this Key Combo is actively processing keys or not.
The current index of the key being waited for in the keyCodes array.
An array of the keycodes that comprise this combo.
A reference to the Keyboard Plugin
Has this Key Combo been matched yet?
The max delay in ms between each key press. Above this the combo is reset. 0 means disabled.
ReadonlyprogressHow far complete is this combo? A value between 0 and 1.
If the combo has previously been matched and the user presses the first key of the combo again, the combo will reset.
If the user presses an incorrect key, the combo sequence will be reset to the beginning.
The length of this combo (in keycodes)
The time the previous key in the combo was matched.
The time the entire combo was matched.
A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them it will emit a
keycombomatchevent from the Keyboard Manager.The keys to be listened for can be defined as:
A string (i.e. 'ATARI') An array of either integers (key codes) or strings, or a mixture of both An array of objects (such as Key objects) with a public 'keyCode' property
For example, to listen for the Konami code (up, up, down, down, left, right, left, right, b, a, enter) you could pass the following array of key codes:
Or, to listen for the user entering the word PHASER: