Key Combo Max Key Delay
Demonstrates how to set a time limit between key presses for a key combo, resetting the sequence if the delay is exceeded.
1024 × 768
class Example extends Phaser.Scene
{
create ()
{
// They get 1 second to press the next key in the combo, or it resets
const combo = this.input.keyboard.createCombo('phaser', { maxKeyDelay: 1000 });
this.input.keyboard.on('keycombomatch', event =>
{
console.log('You typed phaser quickly!');
});
}
}
const config = {
scale: { mode: Phaser.Scale.FIT },
type: Phaser.CANVAS,
parent: 'game-container',
scene: Example
};
const game = new Phaser.Game(config);