- Source: src/input/keyboard/index.js (Line 7)
Classes
Namespaces
Methods
-
<static> DownDuration(key [, duration])
-
Returns
true
if the Key was pressed down within theduration
value given, based on the current game clock time. Orfalse
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 withinduration
ms ago, otherwisefalse
.- 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, otherwisefalse
.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, otherwisefalse
.- 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, otherwisefalse
.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, otherwisefalse
.- Type
- boolean
-
<static> UpDuration(key [, duration])
-
Returns
true
if the Key was released within theduration
value given, based on the current game clock time. Or returnsfalse
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 withinduration
ms ago, otherwisefalse
.- Type
- boolean