mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 07:01:20 +00:00
Fixed Body.removeFromWorld
This commit is contained in:
parent
7373db6e8c
commit
f6807e23c6
3 changed files with 12 additions and 6 deletions
|
@ -903,9 +903,11 @@ Object.defineProperty(Phaser.Sprite.prototype, "exists", {
|
|||
{
|
||||
// exists = false
|
||||
this._cache[6] = 0;
|
||||
console.log('exists false');
|
||||
|
||||
if (this.body)
|
||||
{
|
||||
console.log('exists false remove from world');
|
||||
this.body.removeFromWorld();
|
||||
}
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ Phaser.Physics.Body.prototype = {
|
|||
*/
|
||||
addToWorld: function () {
|
||||
|
||||
if (this.data.world !== this.game.physics)
|
||||
if (this.data.world !== this.game.physics.world)
|
||||
{
|
||||
this.game.physics.addBody(this);
|
||||
}
|
||||
|
@ -546,9 +546,9 @@ Phaser.Physics.Body.prototype = {
|
|||
*/
|
||||
removeFromWorld: function () {
|
||||
|
||||
if (this.data.world === this.game.physics)
|
||||
if (this.data.world === this.game.physics.world)
|
||||
{
|
||||
this.game.physics.removeBody(this.data);
|
||||
this.game.physics.removeBody(this);
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -208,11 +208,15 @@ Phaser.Physics.World.prototype = {
|
|||
if (event.bodyA.id > 1 && event.bodyB.id > 1)
|
||||
{
|
||||
console.log('impactHandler');
|
||||
console.log(event);
|
||||
console.log(event.bodyA.parent.sprite.key);
|
||||
console.log(event.bodyB.parent.sprite.key);
|
||||
}
|
||||
|
||||
event = {};
|
||||
if (event.bodyB.parent.sprite.key == 'box')
|
||||
{
|
||||
console.log(event.bodyB.parent.sprite.key + ' KILLED');
|
||||
event.bodyB.parent.sprite.kill();
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue