Skip to content

Commit 731b006

Browse files
committed
Add active to Group create methods
- Adds `active=true` argument to Group#create - Adds `active=true` config value to Group#createMultiple etc.
1 parent 1d23aad commit 731b006

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/gameobjects/group/Group.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,18 @@ var Group = new Class({
166166
* @param {number} y - The vertical position of this Game Object in the world.
167167
* @param {string} texture - The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
168168
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
169-
* @param {boolean} [visible=true] - [description]
169+
* @param {string|integer} [frame] - An optional frame from the Texture this Game Object is rendering with.
170+
* @param {boolean} [visible=true] - The {@link Phaser.GameObjects.Components.Visible#visible} state of this Game Object.
171+
* @param {boolean} [active=true] - The {@link Phaser.GameObjects.GameObject#active} state of this Game Object.
170172
*
171173
* @return {Phaser.GameObjects.GameObject} [description]
172174
*/
173-
create: function (x, y, key, frame, visible)
175+
create: function (x, y, key, frame, visible, active)
174176
{
175177
if (key === undefined) { key = this.defaultKey; }
176178
if (frame === undefined) { frame = this.defaultFrame; }
177179
if (visible === undefined) { visible = true; }
180+
if (active === undefined) { active = true; }
178181

179182
// Pool?
180183
if (this.isFull())
@@ -192,6 +195,7 @@ var Group = new Class({
192195
}
193196

194197
child.visible = visible;
198+
child.setActive(active);
195199

196200
this.add(child);
197201

@@ -244,6 +248,7 @@ var Group = new Class({
244248
var key = GetFastValue(options, 'key', undefined);
245249
var frame = GetFastValue(options, 'frame', null);
246250
var visible = GetFastValue(options, 'visible', true);
251+
var active = GetFastValue(options, 'active', true);
247252

248253
var entries = [];
249254

@@ -287,7 +292,7 @@ var Group = new Class({
287292

288293
for (var c = 0; c < range.length; c++)
289294
{
290-
entries.push(this.create(0, 0, range[c].a, range[c].b, visible));
295+
entries.push(this.create(0, 0, range[c].a, range[c].b, visible, active));
291296
}
292297

293298
// Post-creation options (applied only to those items created in this call):

0 commit comments

Comments
 (0)