Namespace: Keyboard

Phaser.Input. Keyboard

Classes

Key
KeyboardManager
KeyboardPlugin
KeyCombo

Namespaces

Events
KeyCodes

Methods


<static> DownDuration(key [, duration])

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 Argument 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.

Since: 3.0.0
Source: src/input/keyboard/keys/DownDuration.js (Line 7)
Returns:

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

Type
boolean

<static> JustDown(key)

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.

Since: 3.0.0
Source: src/input/keyboard/keys/JustDown.js (Line 7)
Returns:

true if the Key was just pressed, otherwise false.

Type
boolean

<static> JustUp(key)

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.

Since: 3.0.0
Source: src/input/keyboard/keys/JustUp.js (Line 7)
Returns:

true if the Key was just released, otherwise false.

Type
boolean

<static> UpDuration(key [, duration])

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 Argument 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.

Since: 3.0.0
Source: src/input/keyboard/keys/UpDuration.js (Line 7)
Returns:

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

Type
boolean