diff --git a/src/gameobjects/container/Container.js b/src/gameobjects/container/Container.js index 3ba4c9451..63360a9e8 100644 --- a/src/gameobjects/container/Container.js +++ b/src/gameobjects/container/Container.js @@ -126,7 +126,7 @@ var Container = new Class({ * @private * @since 3.4.0 */ - this.addCallback = this.addHandler; + this.addCallback = this.addHandler.bind(this); /** * A callback that is invoked every time a child is removed from this list. @@ -136,7 +136,7 @@ var Container = new Class({ * @private * @since 3.4.0 */ - this.removeCallback = this.removeHandler; + this.removeCallback = this.removeHandler.bind(this); /** * A reference to the Scene Display List. @@ -151,9 +151,9 @@ var Container = new Class({ this.setPosition(x, y); this.clearAlpha(); - if (Array.isArray(children)) + if (children) { - this.addMultiple(children); + this.add(children); } }, @@ -196,7 +196,7 @@ var Container = new Class({ * @param {Phaser.GameObjects.Container} list - The List the Game Object was added to (also this Container) * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just added to this Container. */ - addHandler: function (list, gameObject) + addHandler: function (gameObject) { gameObject.on('destroy', this.remove, this); @@ -209,7 +209,7 @@ var Container = new Class({ gameObject.parentContainer.remove(gameObject); } - gameObject.parentContainer = list; + gameObject.parentContainer = this; } }, @@ -223,9 +223,9 @@ var Container = new Class({ * @param {Phaser.GameObjects.Container} list - The List the Game Object was removed from (also this Container) * @param {Phaser.GameObjects.GameObject} gameObject - The Game Object that was just removed from this Container. */ - removeHandler: function (list, gameObject) + removeHandler: function (gameObject) { - gameObject.off('destroy', list.remove, this); + gameObject.off('destroy', this.remove, this); if (this.exclusive) { diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index b1cc2b5dd..1f84b124e 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -11,7 +11,7 @@ var DeathZone = require('./zones/DeathZone'); var EdgeZone = require('./zones/EdgeZone'); var EmitterOp = require('./EmitterOp'); var GetFastValue = require('../../utils/object/GetFastValue'); -var GetRandomElement = require('../../utils/array/GetRandomElement'); +var GetRandom = require('../../utils/array/GetRandom'); var HasAny = require('../../utils/object/HasAny'); var HasValue = require('../../utils/object/HasValue'); var Particle = require('./Particle'); @@ -943,7 +943,7 @@ var ParticleEmitter = new Class({ } else if (this.randomFrame) { - return GetRandomElement(this.frames); + return GetRandom(this.frames); } else { diff --git a/src/tilemaps/components/Randomize.js b/src/tilemaps/components/Randomize.js index a5134bc7c..cc52b8e19 100644 --- a/src/tilemaps/components/Randomize.js +++ b/src/tilemaps/components/Randomize.js @@ -5,7 +5,7 @@ */ var GetTilesWithin = require('./GetTilesWithin'); -var GetRandomElement = require('../../utils/array/GetRandomElement'); +var GetRandom = require('../../utils/array/GetRandom'); /** * Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the @@ -44,7 +44,7 @@ var Randomize = function (tileX, tileY, width, height, indexes, layer) for (i = 0; i < tiles.length; i++) { - tiles[i].index = GetRandomElement(indexes); + tiles[i].index = GetRandom(indexes); } };