You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -6390,6 +6390,7 @@ Phaser.Group.prototype.getIndex = function (child) {
6390
6390
* @method Phaser.Group#replace
6391
6391
* @param {*} oldChild - The child in this Group that will be replaced.
6392
6392
* @param {*} newChild - The child to be inserted into this Group.
6393
+
* @return {*} Returns the oldChild that was replaced within this Group.
6393
6394
*/
6394
6395
Phaser.Group.prototype.replace = function (oldChild, newChild) {
6395
6396
@@ -6408,9 +6409,13 @@ Phaser.Group.prototype.replace = function (oldChild, newChild) {
6408
6409
}
6409
6410
}
6410
6411
6411
-
this.removeChild(oldChild);
6412
+
var temp = oldChild;
6413
+
6414
+
this.remove(temp);
6412
6415
6413
6416
this.addAt(newChild, index);
6417
+
6418
+
return temp;
6414
6419
}
6415
6420
6416
6421
}
@@ -7249,12 +7254,14 @@ Phaser.Group.prototype.removeBetween = function (startIndex, endIndex) {
7249
7254
*
7250
7255
* @method Phaser.Group#destroy
7251
7256
* @param {boolean} [destroyChildren=true] - Should every child of this Group have its destroy method called?
7257
+
* @param {boolean} [soft=false] - A 'soft destroy' (set to true) doesn't remove this Group from its parent or null the game reference. Set to false and it does.
7252
7258
*/
7253
-
Phaser.Group.prototype.destroy = function (destroyChildren) {
7259
+
Phaser.Group.prototype.destroy = function (destroyChildren, soft) {
7254
7260
7255
7261
if (this.game === null) { return; }
7256
7262
7257
7263
if (typeof destroyChildren === 'undefined') { destroyChildren = true; }
7264
+
if (typeof soft === 'undefined') { soft = false; }
7258
7265
7259
7266
if (destroyChildren)
7260
7267
{
@@ -7275,13 +7282,16 @@ Phaser.Group.prototype.destroy = function (destroyChildren) {
7275
7282
this.removeAll();
7276
7283
}
7277
7284
7278
-
this.parent.removeChild(this);
7285
+
this.cursor = null;
7279
7286
7280
-
this.game = null;
7287
+
if (!soft)
7288
+
{
7289
+
this.parent.removeChild(this);
7281
7290
7282
-
this.exists = false;
7291
+
this.game = null;
7283
7292
7284
-
this.cursor = null;
7293
+
this.exists = false;
7294
+
}
7285
7295
7286
7296
}
7287
7297
@@ -7493,15 +7503,16 @@ Phaser.World.prototype.setBounds = function (x, y, width, height) {
7493
7503
7494
7504
/**
7495
7505
* Destroyer of worlds.
7496
-
* @method Phaser.World#destroy
7506
+
* @method Phaser.World#shutdown
7497
7507
*/
7498
-
Phaser.World.prototype.destroy = function () {
7508
+
Phaser.World.prototype.shutdown = function () {
7499
7509
7500
7510
this.camera.reset();
7501
7511
7502
7512
this.game.input.reset(true);
7503
7513
7504
-
this.removeAll();
7514
+
// World is a Group, so run a soft destruction on this and all children.
// If the object is using pixelPerfect checks, or has a higher InputManager.PriorityID OR if the priority ID is the same as the current highest AND it has a higher renderOrderID, then set it to the top
0 commit comments