Phaser.GameObjectFactory = function (game){ this.game = game; this.world = this.game.world; } ; Phaser.GameObjectFactory.prototype = { existing: function (object){ return this.world.add(object); } , sprite: function (x, y, key, frame){ return this.world.create(x, y, key, frame); } , child: function (group, x, y, key, frame){ return group.create(x, y, key, frame); } , tween: function (obj){ return this.game.tweens.create(obj); } , group: function (parent, name){ return new Phaser.Group(this.game, parent, name); } , audio: function (key, volume, loop, connect){ return this.game.sound.add(key, volume, loop, connect); } , tileSprite: function (x, y, width, height, key, frame){ return this.world.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame)); } , text: function (x, y, text, style){ return this.world.add(new Phaser.Text(this.game, x, y, text, style)); } , button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame){ return this.world.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame)); } , graphics: function (x, y){ return this.world.add(new Phaser.Graphics(this.game, x, y)); } , emitter: function (x, y, maxParticles){ return this.game.particles.add(new Phaser.Particles.Arcade.Emitter(this.game, x, y, maxParticles)); } , bitmapText: function (x, y, text, style){ return this.world.add(new Phaser.BitmapText(this.game, x, y, text, style)); } , tilemap: function (key){ return new Phaser.Tilemap(this.game, key); } , tileset: function (key){ return this.game.cache.getTileset(key); } , tilemapLayer: function (x, y, width, height, tileset, tilemap, layer){ return this.world.add(new Phaser.TilemapLayer(this.game, x, y, width, height, tileset, tilemap, layer)); } , renderTexture: function (key, width, height){ var texture = new Phaser.RenderTexture(this.game, key, width, height); this.game.cache.addRenderTexture(key, texture); return texture; } , bitmapData: function (width, height){ return new Phaser.BitmapData(this.game, width, height); } , filter: function (filter){ var args = Array.prototype.splice.call(arguments, 1); var filter = new Phaser.Filter[filter](this.game); filter.init.apply(filter, args); return filter; } } ;