Skip to content

Commit 8ec9061

Browse files
committed
Removed 'group' / 'parent' argument and forced to the State children component. You should use 'make' if you wish to add elsewhere.
1 parent f79dcd0 commit 8ec9061

10 files changed

Lines changed: 15 additions & 30 deletions

File tree

v3/src/gameobjects/FactoryContainer.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,14 @@ var factories = {};
1212

1313
var FactoryContainer = function ()
1414
{
15-
// console.log('FactoryContainer is alive');
16-
1715
this.register = function (factory)
1816
{
1917
if (factories.hasOwnProperty(factory.KEY))
2018
{
21-
// console.log('Already registered', factory.KEY);
22-
2319
return this.getType(factory.KEY);
2420
}
2521
else
2622
{
27-
// console.log('registering', factory.KEY);
28-
2923
factories[factory.KEY] = {
3024
add: factory.add,
3125
make: factory.make
@@ -46,8 +40,6 @@ var FactoryContainer = function ()
4640
{
4741
if (factories.hasOwnProperty(factory))
4842
{
49-
// console.log('Loading', factory);
50-
5143
dest[factory] = (isFactory) ? factories[factory].add : factories[factory].make;
5244
}
5345
}

v3/src/gameobjects/bitmaptext/dynamic/DynamicBitmapTextFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var DynamicBitmapTextFactory = {
77

88
add: function (x, y, font, text, size, align)
99
{
10-
return this.state.children.add(new BitmapText(this.state, x, y, font, text, size, align));
10+
return this.children.add(new BitmapText(this.state, x, y, font, text, size, align));
1111
},
1212

1313
make: function (x, y, font, text, size, align)

v3/src/gameobjects/bitmaptext/static/BitmapTextFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var BitmapTextFactory = {
77

88
add: function (x, y, font, text, size, align)
99
{
10-
return this.state.children.add(new BitmapText(this.state, x, y, font, text, size, align));
10+
return this.children.add(new BitmapText(this.state, x, y, font, text, size, align));
1111
},
1212

1313
make: function (x, y, font, text, size, align)

v3/src/gameobjects/blitter/BlitterFactory.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ var BlitterFactory = {
66

77
KEY: 'blitter',
88

9-
add: function (x, y, key, frame, parent)
9+
add: function (x, y, key, frame)
1010
{
11-
if (parent === undefined) { parent = this.state; }
12-
13-
return parent.children.add(new Blitter(this.state, x, y, key, frame));
11+
return this.children.add(new Blitter(this.state, x, y, key, frame));
1412
},
1513

1614
make: function (x, y, key, frame)

v3/src/gameobjects/graphics/GraphicsFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var GraphicsFactory = {
77

88
add: function (options)
99
{
10-
return this.state.children.add(new Graphics(this.state, options));
10+
return this.children.add(new Graphics(this.state, options));
1111
},
1212

1313
make: function (options)

v3/src/gameobjects/image/ImageFactory.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ var ImageFactory = {
2222
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
2323
* @return {Phaser.Image} The newly created Image object.
2424
*/
25-
add: function (x, y, key, frame, parent)
25+
add: function (x, y, key, frame)
2626
{
27-
if (parent === undefined) { parent = this.state; }
28-
29-
return parent.children.add(new Image(this.state, x, y, key, frame));
27+
return this.children.add(new Image(this.state, x, y, key, frame));
3028
},
3129

3230
make: function (x, y, key, frame)

v3/src/gameobjects/sprite/SpriteFactory.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,13 @@ var SpriteFactory = {
2626
* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.
2727
* @return {Phaser.Sprite} The newly created Sprite object.
2828
*/
29-
add: function (x, y, key, frame, group)
29+
add: function (x, y, key, frame)
3030
{
31-
if (group === undefined) { group = this.state; }
32-
33-
// console.log('ImageFactory.add', key, x, y, frame, group);
34-
// console.log('into State', this.state);
35-
36-
return group.children.add(new Sprite(this.state, x, y, key, frame));
31+
return this.children.add(new Sprite(this.state, x, y, key, frame));
3732
},
3833

3934
make: function (x, y, key, frame)
4035
{
41-
// console.log('ImageFactory.make', key, x, y, frame);
42-
4336
return new Sprite(this.state, x, y, key, frame);
4437
}
4538

v3/src/gameobjects/text/static/TextFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var TextFactory = {
77

88
add: function (x, y, text, style)
99
{
10-
return this.state.children.add(new Text(this.state, x, y, text, style));
10+
return this.children.add(new Text(this.state, x, y, text, style));
1111
},
1212

1313
make: function (x, y, text, style)

v3/src/state/systems/GameObjectCreator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var GameObjectCreator = function (state)
1717
{
1818
this.state = state;
1919

20+
this.children = state.sys.children;
21+
2022
FactoryContainer.load(this, false);
2123
};
2224

v3/src/state/systems/GameObjectFactory.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ var GameObjectFactory = function (state)
1717
{
1818
this.state = state;
1919

20+
this.children = state.sys.children;
21+
2022
FactoryContainer.load(this, true);
2123
};
2224

@@ -26,7 +28,7 @@ GameObjectFactory.prototype = {
2628

2729
existing: function (child)
2830
{
29-
return this.state.children.add(child);
31+
return this.children.add(child);
3032
},
3133

3234
destroy: function ()

0 commit comments

Comments
 (0)