Skip to content

Commit 562eb4a

Browse files
committed
All GameObjects now have a physics body property (which is null by default)
1 parent 0a1e4e0 commit 562eb4a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

v3/src/gameobjects/GameObject.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ var GameObject = new Class({
2424
this.renderMask = 15;
2525
this.renderFlags = 15;
2626

27+
// instance of Phaser.Input.InteractiveObject if input enabled
2728
this.input = null;
2829

30+
// instance of Phaser.Physics.X.Body if physics enabled (X = the physics system being used by the Scene)
31+
this.body = null;
32+
2933
// Trigger a scene z-depth sort
3034
this.scene.sys.sortChildrenFlag = true;
3135
},
@@ -80,6 +84,11 @@ var GameObject = new Class({
8084
this.scene.sys.inputManager.clear(this);
8185
}
8286

87+
if (this.body)
88+
{
89+
this.scene.sys.physicsManager.remove(this);
90+
}
91+
8392
this.active = false;
8493

8594
this.scene = undefined;

0 commit comments

Comments
 (0)