Phaser.GameObjectFactory = function (game){ this.game = game; this.world = this.game.world; } ; Phaser.GameObjectFactory.prototype = { game: null , world: null , sprite: function (x, y, key, frame){ return this.world.add(new Phaser.Sprite(this.game, x, y, key, frame)); } , child: function (parent, x, y, key, frame){ var child = this.world.add(new Phaser.Sprite(this.game, x, y, key, frame)); parent.addChild(child); return child; } , tween: function (obj, localReference){ return this.game.tweens.create(obj, localReference); } , group: function (parent, name){ return new Phaser.Group(this.game, parent, name); } , audio: function (key, volume, loop){ return this.game.sound.add(key, volume, loop); } , 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)); } } ;