mirror of
https://github.com/photonstorm/phaser
synced 2025-03-06 00:07:31 +00:00
The physics world is now cleared on state swap (fixes #505)
This commit is contained in:
parent
33da238e97
commit
66bdf56349
2 changed files with 18 additions and 0 deletions
src
|
@ -286,6 +286,11 @@ Phaser.StateManager.prototype = {
|
||||||
|
|
||||||
this.game.world.destroy();
|
this.game.world.destroy();
|
||||||
|
|
||||||
|
if (this.game.physics)
|
||||||
|
{
|
||||||
|
this.game.physics.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (this._clearCache === true)
|
if (this._clearCache === true)
|
||||||
{
|
{
|
||||||
this.game.cache.destroy();
|
this.game.cache.destroy();
|
||||||
|
|
|
@ -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
|
* @method Phaser.Physics.World#destroy
|
||||||
*/
|
*/
|
||||||
destroy: function () {
|
destroy: function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue