Phaser API Documentation

  Version: 
Filter
Namespace: Keyboard
Phaser.Input.Keyboard

Classes

Namespace

Methods

<static, private> AdvanceKeyCombo(event, combo)
Focus
Focus

Description:

Used internally by the KeyCombo class. Return true if it reached the end of the combo, false if not.

Parameters:

name type description
event KeyboardEvent

The native Keyboard Event.

combo Phaser.Input.Keyboard.KeyCombo

The KeyCombo object to advance.

Returns:
Description:

true if it reached the end of the combo, false if not.

Type:
  • boolean
Since: 3.0.0
Focus
Focus
<static, private> ProcessKeyCombo(event, combo)
Focus
Focus

Description:

Used internally by the KeyCombo class.

Parameters:

name type description
event KeyboardEvent

The native Keyboard Event.

combo Phaser.Input.Keyboard.KeyCombo

The KeyCombo object to be processed.

Returns:
Description:

true if the combo was matched, otherwise false.

Type:
  • boolean
Since: 3.0.0
Focus
Focus
<static, private> ResetKeyCombo(combo)
Focus
Focus

Description:

Used internally by the KeyCombo class.

Parameters:

name type description
combo Phaser.Input.Keyboard.KeyCombo

The KeyCombo to reset.

Returns:
Description:

The KeyCombo.

Since: 3.0.0
Focus
Focus
<static> DownDuration(key, [duration])
Focus
Focus

Description:

Returns true if the Key was pressed down within the duration value given, based on the current game clock time. Or false if it either isn't down, or was pressed down longer ago than the given duration.

Parameters:

name type arguments Default description
key Phaser.Input.Keyboard.Key

The Key object to test.

duration number <optional> 50

The duration, in ms, within which the key must have been pressed down.

Returns:
Description:

true if the Key was pressed down within duration ms ago, otherwise false.

Type:
  • boolean
Since: 3.0.0
Focus
Focus
<static> JustDown(key)
Focus
Focus

Description:

The justDown value allows you to test if this Key has just been pressed down or not.

When you check this value it will return true if the Key is down, otherwise false.

You can only call justDown once per key press. It will only return true once, until the Key is released and pressed down again. This allows you to use it in situations where you want to check if this key is down without using an event, such as in a core game loop.

Parameters:

name type description
key Phaser.Input.Keyboard.Key

The Key to check to see if it's just down or not.

Returns:
Description:

true if the Key was just pressed, otherwise false.

Type:
  • boolean
Since: 3.0.0
Focus
Focus
<static> JustUp(key)
Focus
Focus

Description:

The justUp value allows you to test if this Key has just been released or not.

When you check this value it will return true if the Key is up, otherwise false.

You can only call JustUp once per key release. It will only return true once, until the Key is pressed down and released again. This allows you to use it in situations where you want to check if this key is up without using an event, such as in a core game loop.

Parameters:

name type description
key Phaser.Input.Keyboard.Key

The Key to check to see if it's just up or not.

Returns:
Description:

true if the Key was just released, otherwise false.

Type:
  • boolean
Since: 3.0.0
Focus
Focus
<static> UpDuration(key, [duration])
Focus
Focus

Description:

Returns true if the Key was released within the duration value given, based on the current game clock time. Or returns false if it either isn't up, or was released longer ago than the given duration.

Parameters:

name type arguments Default description
key Phaser.Input.Keyboard.Key

The Key object to test.

duration number <optional> 50

The duration, in ms, within which the key must have been released.

Returns:
Description:

true if the Key was released within duration ms ago, otherwise false.

Type:
  • boolean
Since: 3.0.0
Focus
Focus