mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
The physics world is now cleared on state swap (fixes #505)
This commit is contained in:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user