mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Merge pull request #961 from Phaiax/issue-bodyEnable
Body.enable only exists in Arcade physics, so move conditions concerning...
This commit is contained in:
commit
7fa3110c06
3 changed files with 25 additions and 15 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue