Skip to content

Commit 2dd7e68

Browse files
committed
Extends the Factory.
1 parent a157472 commit 2dd7e68

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/core/Game.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,20 @@ Phaser.Game.prototype = {
616616

617617
// this.world = new Phaser.World(this);
618618

619+
// Inject any new Factory helpers that exist in the build
620+
for (var gameobject in Phaser.GameObject)
621+
{
622+
if (Phaser.GameObject[gameobject].hasOwnProperty('FACTORY_KEY'))
623+
{
624+
var key = Phaser.GameObject[gameobject]['FACTORY_KEY'];
625+
626+
// console.log('found', key);
627+
628+
Phaser.GameObject.Factory.prototype[key] = Phaser.GameObject[gameobject]['FACTORY_ADD'];
629+
}
630+
}
631+
619632
this.add = new Phaser.GameObject.Factory(this);
620-
this.add.boot();
621633

622634
this.make = new Phaser.GameObjectCreator(this);
623635
this.cache = new Phaser.Cache(this);

0 commit comments

Comments
 (0)