mirror of
https://github.com/photonstorm/phaser
synced 2025-02-01 06:43:35 +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
|
@ -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();
|
||||
|
|
|
@ -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 () {
|
||||
|
|
Loading…
Reference in a new issue