mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Added Time.physicsElapsedMS and used in Sprite lifespan and Tweens.
This commit is contained in:
parent
fb733ddcca
commit
471ad20b4a
3 changed files with 12 additions and 3 deletions
|
@ -252,7 +252,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
|||
// Only apply lifespan decrement in the first updateLogic pass.
|
||||
if (this.lifespan > 0 && this.game.updateNumber === 0)
|
||||
{
|
||||
this.lifespan -= this.game.time.elapsedMS;
|
||||
this.lifespan -= this.game.time.physicsElapsedMS;
|
||||
|
||||
if (this.lifespan <= 0)
|
||||
{
|
||||
|
|
|
@ -86,6 +86,13 @@ Phaser.Time = function (game) {
|
|||
*/
|
||||
this.physicsElapsed = 0;
|
||||
|
||||
/**
|
||||
* The Time.physicsElapsed property * 1000.
|
||||
*
|
||||
* @property {number} physicsElapsedMS
|
||||
*/
|
||||
this.physicsElapsedMS = 0;
|
||||
|
||||
/**
|
||||
* The desired frame rate of the game.
|
||||
*
|
||||
|
@ -355,6 +362,8 @@ Phaser.Time.prototype = {
|
|||
// Set the physics elapsed time... this will always be 1 / this.desiredFps because we're using fixed time steps in game.update now
|
||||
this.physicsElapsed = 1 / this.desiredFps;
|
||||
|
||||
this.physicsElapsedMS = this.physicsElapsed * 1000;
|
||||
|
||||
if (this.advancedTiming)
|
||||
{
|
||||
this.msMin = Math.min(this.msMin, this.elapsed);
|
||||
|
|
|
@ -332,12 +332,12 @@ Phaser.TweenData.prototype = {
|
|||
|
||||
if (this.parent.reverse)
|
||||
{
|
||||
this.dt -= (this.game.time.physicsElapsed * 1000) * this.parent.timeScale;
|
||||
this.dt -= this.game.time.physicsElapsedMS * this.parent.timeScale;
|
||||
this.dt = Math.max(this.dt, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.dt += (this.game.time.physicsElapsed * 1000) * this.parent.timeScale;
|
||||
this.dt += this.game.time.physicsElapsedMS * this.parent.timeScale;
|
||||
this.dt = Math.min(this.dt, this.duration);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue