Checks if the given Key object is currently being held down.
The difference between this method and checking the Key.isDown
property directly is that you can provide
a duration to this method. For example, if you wanted a key press to fire a bullet, but you only wanted
it to be able to fire every 100ms, then you can call this method with a duration
of 100 and it
will only return true
every 100ms.
If the Keyboard Plugin has been disabled, this method will always return false
.
name | type | arguments | description |
---|---|---|---|
key | Phaser.Input.Keyboard.Key |
A Key object. |
|
duration | number | <optional> |
The duration which must have elapsed before this Key is considered as being down. |
true
if the Key is down within the duration specified, otherwise false
.