Merge pull request #961 from Phaiax/issue-bodyEnable

Body.enable only exists in Arcade physics, so move conditions concerning...
This commit is contained in:
Richard Davey 2014-07-01 15:27:33 +01:00
commit 7fa3110c06
3 changed files with 25 additions and 15 deletions

View file

@ -209,7 +209,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
this._cache[1] = this.world.y;
this._cache[2] = this.rotation;
if (this.body && this.body.enable)
if (this.body)
{
this.body.preUpdate();
}
@ -284,7 +284,7 @@ Phaser.Sprite.prototype.preUpdate = function() {
this.animations.update();
if (this.body && this.body.enable)
if (this.body)
{
this.body.preUpdate();
}
@ -323,7 +323,7 @@ Phaser.Sprite.prototype.postUpdate = function() {
this.key.render();
}
if (this.exists && this.body && this.body.enable)
if (this.exists && this.body)
{
this.body.postUpdate();
}

View file

@ -173,7 +173,7 @@ Phaser.TileSprite.prototype.preUpdate = function() {
this._cache[1] = this.world.y;
this._cache[2] = this.rotation;
if (this.body && this.body.enable)
if (this.body)
{
this.body.preUpdate();
}
@ -241,7 +241,7 @@ Phaser.TileSprite.prototype.preUpdate = function() {
this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed;
}
if (this.body && this.body.enable)
if (this.body)
{
this.body.preUpdate();
}
@ -274,7 +274,7 @@ Phaser.TileSprite.prototype.update = function() {
*/
Phaser.TileSprite.prototype.postUpdate = function() {
if (this.exists && this.body && this.body.enable)
if (this.exists && this.body)
{
this.body.postUpdate();
}

View file

@ -365,6 +365,11 @@ Phaser.Physics.Arcade.Body.prototype = {
*/
preUpdate: function () {
if (!this.enable)
{
return;
}
this.phase = 1;
// Store and reset collision flags
@ -440,6 +445,11 @@ Phaser.Physics.Arcade.Body.prototype = {
*/
postUpdate: function () {
if (!this.enable)
{
return;
}
// Only allow postUpdate to be called once per frame
if (this.phase === 2)
{