Skip to content

Commit 6cd1761

Browse files
committed
Moved time to getter and fixed checkDown.
1 parent 7f91956 commit 6cd1761

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

src/input/keyboard/KeyboardPlugin.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,6 @@ var KeyboardPlugin = new Class({
146146
*/
147147
this.combos = [];
148148

149-
/**
150-
* Internal time value.
151-
*
152-
* @name Phaser.Input.Keyboard.KeyboardPlugin#time
153-
* @type {number}
154-
* @private
155-
* @since 3.11.0
156-
*/
157-
this.time = 0;
158-
159149
sceneInputPlugin.pluginEvents.once(InputEvents.BOOT, this.boot, this);
160150
sceneInputPlugin.pluginEvents.on(InputEvents.START, this.start, this);
161151
},
@@ -628,7 +618,7 @@ var KeyboardPlugin = new Class({
628618
* @param {Phaser.Input.Keyboard.Key} key - A Key object.
629619
* @param {number} [duration=0] - The duration which must have elapsed before this Key is considered as being down.
630620
*
631-
* @return {boolean} `True` if the Key is down within the duration specified, otherwise `false`.
621+
* @return {boolean} `true` if the Key is down within the duration specified, otherwise `false`.
632622
*/
633623
checkDown: function (key, duration)
634624
{
@@ -653,13 +643,9 @@ var KeyboardPlugin = new Class({
653643
* @method Phaser.Input.Keyboard.KeyboardPlugin#update
654644
* @private
655645
* @since 3.10.0
656-
*
657-
* @param {number} time - The game loop time value.
658646
*/
659-
update: function (time)
647+
update: function ()
660648
{
661-
this.time = time;
662-
663649
var queue = this.manager.queue;
664650
var len = queue.length;
665651

@@ -854,6 +840,23 @@ var KeyboardPlugin = new Class({
854840
this.settings = null;
855841
this.sceneInputPlugin = null;
856842
this.manager = null;
843+
},
844+
845+
/**
846+
* Internal time value.
847+
*
848+
* @name Phaser.Input.Keyboard.KeyboardPlugin#time
849+
* @type {number}
850+
* @private
851+
* @since 3.11.0
852+
*/
853+
time: {
854+
855+
get: function ()
856+
{
857+
return this.sceneInputPlugin.manager.time;
858+
}
859+
857860
}
858861

859862
});

0 commit comments

Comments
 (0)