Skip to content

Commit 50a167a

Browse files
committed
Fixed issue with seamless delta reset and moved frame increment to below callback
1 parent 19a0638 commit 50a167a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/boot/TimeStep.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,13 +445,11 @@ var TimeStep = new Class({
445445
*
446446
* @method Phaser.Boot.TimeStep#step
447447
* @since 3.0.0
448-
*
448+
*
449449
* @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
450450
*/
451451
step: function (time)
452452
{
453-
this.frame++;
454-
455453
var before = time - this.lastTime;
456454

457455
if (before < 0)
@@ -561,6 +559,8 @@ var TimeStep = new Class({
561559

562560
// Shift time value over
563561
this.lastTime = time;
562+
563+
this.frame++;
564564
},
565565

566566
/**
@@ -607,7 +607,7 @@ var TimeStep = new Class({
607607
}
608608
else if (seamless)
609609
{
610-
this.startTime += -this.lastTime + (this.lastTime = window.performance.now());
610+
this.startTime += -this.lastTime + (this.lastTime + window.performance.now());
611611
}
612612

613613
this.raf.start(this.step.bind(this), this.useRAF);

0 commit comments

Comments
 (0)