-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
JustUp.js
36 lines (33 loc) · 1.03 KB
/
JustUp.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* 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.
*
* @function Phaser.Input.Keyboard.JustUp
* @since 3.0.0
*
* @param {Phaser.Input.Keyboard.Key} key - The Key to check to see if it's just up or not.
*
* @return {boolean} `true` if the Key was just released, otherwise `false`.
*/
var JustUp = function (key)
{
if (key._justUp)
{
key._justUp = false;
return true;
}
else
{
return false;
}
};
module.exports = JustUp;