Skip to content

Commit 0284d0b

Browse files
committed
If Time.elapsed was > Time.timeCap it would reset the elapsed value to be 1 / 60. It's now set to Time.timeCap and Time.timeCap defaults to 1 / 60 * 1000 as it's a ms value (thanks @casensiom phaserjs#899)
1 parent 10e7d8f commit 0284d0b

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
@@ -120,6 +120,7 @@ Version 2.1.0 - "Cairhien" - -in development-
120120
* Arcade.overlap and collide are now more consistent about allowing a Group vs. Group or Group vs. Array of Groups set (thanks @pyromanfo #877 #1147)
121121
* The Pointer move callbacks are now sent an extra parameter: `fromClick` allowing your callbacks to distinguish between the Pointer just moving, or moving as a result of being pressed down (thanks @iforce2d #1055)
122122
* GamePad and SinglePad onAxisCallback parameters have changed. You are now sent: this (a reference to the SinglePad that caused the callback), the axis index and the axis value in that order.
123+
* If Time.elapsed was > Time.timeCap it would reset the elapsed value to be 1 / 60. It's now set to Time.timeCap and Time.timeCap defaults to `1 / 60 * 1000` as it's a ms value (thanks @casensiom #899)
123124

124125
### Bug Fixes
125126

src/time/Time.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Phaser.Time = function (game) {
8989
/**
9090
* @property {number} timeCap - If the difference in time between two frame updates exceeds this value, the frame time is reset to avoid huge elapsed counts.
9191
*/
92-
this.timeCap = 1000;
92+
this.timeCap = 1 / 60 * 1000;
9393

9494
/**
9595
* @property {number} frames - The number of frames record in the last second. Only calculated if Time.advancedTiming is true.
@@ -248,7 +248,7 @@ Phaser.Time.prototype = {
248248
// For some reason the time between now and the last time the game was updated was larger than our timeCap
249249
// This can happen if the Stage.disableVisibilityChange is true and you swap tabs, which makes the raf pause.
250250
// In this case we'll drop to some default values to stop the game timers going nuts.
251-
this.elapsed = 1 / 60;
251+
this.elapsed = this.timeCap;
252252
}
253253

254254
// Calculate physics elapsed, ensure it's > 0, use 1/60 as a fallback

0 commit comments

Comments
 (0)