Skip to content

Commit 72eaee3

Browse files
committed
Adjusted Sprite.preUpdate to remove the lifespan calculation.
1 parent 1068563 commit 72eaee3

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ This fixes a bug in FF where it would use the default DOMMouseWheel (thanks @pns
248248
* Camera.totalInView is a new property that contains the total number of Sprites rendered that have `autoCull` set to true and are within the Cameras view.
249249
* Emitter.setScale fixed minX minY order presedence (thanks spayton)
250250
* Group.iterate can now accept undefined/null as the arguments (thanks @pnstickne #1353 @tasos-ch #1352)
251-
* When you change State the P2 Physics world is no longer fully cleared. All of the bodies, springs, fixtures, materials and constraints are removed - but config settings such as gravity, restitution, the contact solver, etc are all retained. The P2.World object is only created the very first time you call Physics.startSystem. Every subsequent call hits P2.World.reset instead (#1292)
251+
* When you change State the P2 Physics world is no longer fully cleared. All of the bodies, springs, fixtures, materials and constraints are removed - but config settings such as gravity, restitution, the contact solver, etc are all retained. The P2.World object is only created the very first time you call Physics.startSystem. Every subsequent call hits P2.World.reset instead. This fixes "P2.World gravity broken after switching states" (and other related issues) (#1292 #1289 #1176)
252252

253253
### Pixi 2.1.0 New Features
254254

src/core/Game.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ Phaser.Game.prototype = {
725725
var count = 0;
726726

727727
this.updatesThisFrame = Math.floor(this._deltaTime / slowStep);
728+
728729
if (this.forceSingleUpdate)
729730
{
730731
this.updatesThisFrame = Math.min(1, this.updatesThisFrame);

src/gameobjects/Sprite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ Phaser.Sprite.prototype.preUpdate = function() {
250250
}
251251

252252
// Only apply lifespan decrement in the first updateLogic pass.
253-
if (this.lifespan > 0 && this.game.count === 0)
253+
if (this.lifespan > 0 && this.game.updateNumber === 0)
254254
{
255-
this.lifespan -= 1000 * this.game.time.physicsElapsed;
255+
this.lifespan -= this.game.time.elapsedMS;
256256

257257
if (this.lifespan <= 0)
258258
{

0 commit comments

Comments
 (0)