diff --git a/src/core/StateManager.js b/src/core/StateManager.js index 4416f7e5a..bffda116c 100644 --- a/src/core/StateManager.js +++ b/src/core/StateManager.js @@ -286,6 +286,11 @@ Phaser.StateManager.prototype = { this.game.world.destroy(); + if (this.game.physics) + { + this.game.physics.clear(); + } + if (this._clearCache === true) { this.game.cache.destroy(); diff --git a/src/physics/World.js b/src/physics/World.js index 4957303ae..2ca0a844b 100644 --- a/src/physics/World.js +++ b/src/physics/World.js @@ -455,6 +455,19 @@ Phaser.Physics.World.prototype = { }, /** + * Clears all bodies from the simulation. + * + * @method Phaser.Physics.World#clear + */ + clear: function () { + + this.world.clear(); + + }, + + /** + * Clears all bodies from the simulation and unlinks World from Game. Should only be called on game shutdown. Call `clear` on a State change. + * * @method Phaser.Physics.World#destroy */ destroy: function () {