Phaser.GameObjectFactory = function (game){ this.game = game; this.world = this.game.world; } ; Phaser.GameObjectFactory.prototype = { existing: function (object){ return this.world.add(object); } , image: function (x, y, key, frame, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.Image(this.game, x, y, key, frame)); } , sprite: function (x, y, key, frame, group){ if (typeof group === 'undefined') { group = this.world; } return group.create(x, y, key, frame); } , tween: function (object){ return this.game.tweens.create(object); } , group: function (parent, name, addToStage, enableBody, physicsBodyType){ return new Phaser.Group(this.game, parent, name, addToStage, enableBody, physicsBodyType); } , physicsGroup: function (physicsBodyType, parent, name, addToStage){ return new Phaser.Group(this.game, parent, name, addToStage, true , physicsBodyType); } , spriteBatch: function (parent, name, addToStage){ if (typeof parent === 'undefined') { parent = null ; } if (typeof name === 'undefined') { name = 'group'; } if (typeof addToStage === 'undefined') { addToStage = false ; } return new Phaser.SpriteBatch(this.game, parent, name, addToStage); } , audio: function (key, volume, loop, connect){ return this.game.sound.add(key, volume, loop, connect); } , sound: function (key, volume, loop, connect){ return this.game.sound.add(key, volume, loop, connect); } , audioSprite: function (key){ return this.game.sound.addSprite(key); } , tileSprite: function (x, y, width, height, key, frame, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.TileSprite(this.game, x, y, width, height, key, frame)); } , rope: function (x, y, key, frame, points, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.Rope(this.game, x, y, key, frame, points)); } , text: function (x, y, text, style, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.Text(this.game, x, y, text, style)); } , button: function (x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame, upFrame)); } , graphics: function (x, y, group){ if (typeof group === 'undefined') { group = this.world; } return group.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)); } , retroFont: function (font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset){ return new Phaser.RetroFont(this.game, font, characterWidth, characterHeight, chars, charsPerRow, xSpacing, ySpacing, xOffset, yOffset); } , bitmapText: function (x, y, font, text, size, group){ if (typeof group === 'undefined') { group = this.world; } return group.add(new Phaser.BitmapText(this.game, x, y, font, text, size)); } , tilemap: function (key, tileWidth, tileHeight, width, height){ return new Phaser.Tilemap(this.game, key, tileWidth, tileHeight, width, height); } , renderTexture: function (width, height, key, addToCache){ if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); } if (typeof addToCache === 'undefined') { addToCache = false ; } var texture = new Phaser.RenderTexture(this.game, width, height, key); if (addToCache) { this.game.cache.addRenderTexture(key, texture); } return texture; } , video: function (key, captureAudio, width, height){ return new Phaser.Video(this.game, key, captureAudio, width, height); } , bitmapData: function (width, height, key, addToCache){ if (typeof addToCache === 'undefined') { addToCache = false ; } if (typeof key === 'undefined' || key === '') { key = this.game.rnd.uuid(); } var texture = new Phaser.BitmapData(this.game, key, width, height); if (addToCache) { this.game.cache.addBitmapData(key, texture); } return texture; } , 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; } , plugin: function (plugin){ return this.game.plugins.add(plugin); } } ; Phaser.GameObjectFactory.prototype.constructor = Phaser.GameObjectFactory;