Groups now update their children across preUpdate, update and postUpdate.

Sprite.exists = false removes Body from world.
This commit is contained in:
photonstorm
2014-02-13 12:26:39 +00:00
parent 312ec462bc
commit bdb8908fee
5 changed files with 187 additions and 16 deletions
+9 -10
View File
@@ -285,10 +285,12 @@ Phaser.Physics.Body.prototype = {
* Resets the Body force, velocity (linear and angular) and rotation. Optionally resets damping and mass.
*
* @method Phaser.Physics.Body#reset
* @param {number} x - The new x position of the Body.
* @param {number} y - The new x position of the Body.
* @param {boolean} [resetDamping=false] - Resets the linear and angular damping.
* @param {boolean} [resetMass=false] - Sets the Body mass back to 1.
*/
reset: function (resetDamping, resetMass) {
reset: function (x, y, resetDamping, resetMass) {
if (typeof resetDamping === 'undefined') { resetDamping = false; }
if (typeof resetMass === 'undefined') { resetMass = false; }
@@ -307,6 +309,9 @@ Phaser.Physics.Body.prototype = {
this.mass = 1;
}
this.x = x;
this.y = y;
},
/**
@@ -344,21 +349,15 @@ Phaser.Physics.Body.prototype = {
*/
destroy: function () {
this.sprite = null;
if (this.data.world === this.game.physics)
{
this.game.physics.removeBody(this.data);
}
this.removeFromWorld();
this.clearShapes();
this.sprite = null;
/*
this.collideCallback = null;
this.collideCallbackContext = null;
this.customSeparateCallback = null;
this.customSeparateContext = null;
*/
},