You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Key.duration should be "the number of milliseconds this key has been held down for." with default value 0. However I've found that the inital value before the key has been pushed is in fact something else >0. Not sure how that happens, but it's easy to test by printing out the value:
Could be due to Key.reset line 205 in the docs: http://docs.phaser.io/Key.js.html#sunlight-1-line-191
this.duration = this.game.time.now - this.timeDown;
this.timeDown is initially 0, so if reset is called before the key was down at all duration would just become the time at that point. Looking at the values that seems reasonable.
Key.duration should be "the number of milliseconds this key has been held down for." with default value 0. However I've found that the inital value before the key has been pushed is in fact something else >0. Not sure how that happens, but it's easy to test by printing out the value:
var key = this.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
update()
{
console.log("Duration: " + key.duration);
}
The text was updated successfully, but these errors were encountered: