Skip to content

Commit 2425d01

Browse files
committed
You can now pass a Group config into the Factory / constructor.
1 parent e119e3a commit 2425d01

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

v3/src/gameobjects/group/Group.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ var Group = new Class({
1010

1111
initialize:
1212

13-
function Group (state, children)
13+
function Group (state, children, config)
1414
{
1515
this.state = state;
1616

1717
this.children = new Set(children);
1818

1919
this.classType = Sprite;
20+
21+
if (config)
22+
{
23+
this.createMultiple(config);
24+
}
2025
},
2126

2227
update: function (time, delta)

v3/src/gameobjects/group/GroupFactory.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ var GroupFactory = {
55

66
KEY: 'group',
77

8-
add: function (children)
8+
add: function (children, config)
99
{
10-
return new Group(this.state, children);
10+
return new Group(this.state, children, config);
1111
},
1212

1313
make: function (config)
1414
{
15-
var group = new Group(this.state);
16-
17-
group.createFromConfig(config);
18-
19-
return group;
15+
return new Group(this.state, null, config);
2016
}
2117

2218
};

0 commit comments

Comments
 (0)