Skip to content

Commit a8e972b

Browse files
committed
Under setTimeOut (or when forceSetTimeOut was true) the Time was incorrectly setting Time.timeExpected causing game updates to lag (thanks @satan6 phaserjs#2087)
1 parent 5c30a22 commit a8e972b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
290290
* Sound.onEndedHandler has a fix for AudioBufferSourceNode listener memory leak (thanks @Pappa #2069)
291291
* Game.update could call `updateLogic` multiple times in a single frame when catching up with slow device frame rates. This would cause Tweens to advance at twice the speed they should have done (thanks @mkristo)
292292
* Added useCapture flags to removeEventListener in MSPointer class (thanks @pmcmonagle #2055)
293+
* Under setTimeOut (or when `forceSetTimeOut` was true) the Time was incorrectly setting `Time.timeExpected` causing game updates to lag (thanks @satan6 #2087)
293294

294295
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
295296

src/time/Time.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,10 @@ Phaser.Time.prototype = {
385385
if (this.game.raf._isSetTimeOut)
386386
{
387387
// time to call this function again in ms in case we're using timers instead of RequestAnimationFrame to update the game
388-
this.timeToCall = Math.floor(Math.max(0, (1000.0 / this._desiredFps) - (this.timeCallExpected - time)));
388+
this.timeToCall = Math.floor(Math.max(0, (1000.0 / this._desiredFps) - (this.timeExpected - time)));
389389

390390
// time when the next call is expected if using timers
391-
this.timeCallExpected = time + this.timeToCall;
391+
this.timeExpected = time + this.timeToCall;
392392
}
393393

394394
if (this.advancedTiming)

0 commit comments

Comments
 (0)