phaser - v4.0.0-rc.4
    Preparing search index...

    A KeyCombo will listen for a specific string of keys from the Keyboard, and when it receives them it will emit a keycombomatch event 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:

    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!');
    });

    Or, to listen for the user entering the word PHASER:

    this.input.keyboard.createCombo('PHASER');
    
    Index

    Constructors

    Properties

    current: number

    The current keyCode the combo is waiting for.

    deleteOnMatch: boolean

    If the combo matches, will it delete itself?

    enabled: boolean

    A flag that controls if this Key Combo is actively processing keys or not.

    index: number

    The current index of the key being waited for in the 'keys' string.

    keyCodes: any[]

    An array of the keycodes that comprise this combo.

    A reference to the Keyboard Manager

    matched: boolean

    Has this Key Combo been matched yet?

    maxKeyDelay: number

    The max delay in ms between each key press. Above this the combo is reset. 0 means disabled.

    progress: number

    How far complete is this combo? A value between 0 and 1.

    resetOnMatch: boolean

    If previously matched and they press the first key of the combo again, will it reset?

    resetOnWrongKey: boolean

    If they press the wrong key do we reset the combo?

    size: number

    The length of this combo (in keycodes)

    timeLastMatched: number

    The time the previous key in the combo was matched.

    timeMatched: number

    The time the entire combo was matched.

    Methods