Phaser.GameObject.Image = function (game, x, y, key, frame){ this.game = game; var _texture = game.textures.get(key); var _frame = _texture.get(frame); Phaser.GameObject.call(this, game, x, y, _texture, _frame); this.type = Phaser.IMAGE; } ; Phaser.GameObject.Image.prototype = Object.create(Phaser.GameObject.prototype); Phaser.GameObject.Image.prototype.constructor = Phaser.GameObject.Image; Phaser.GameObject.Image.prototype.preUpdate = function (){ if (this.parent) { this.color.worldAlpha = this.parent.color.worldAlpha; } } ; Object.defineProperties(Phaser.GameObject.Image.prototype, { width: { enumerable: true , get: function (){ return this.transform._scaleX * this.frame.realWidth; } , set: function (value){ this.scaleX = value / this.frame.realWidth; } } , height: { enumerable: true , get: function (){ return this.transform._scaleY * this.frame.realHeight; } , set: function (value){ this.scaleY = value / this.frame.realHeight; } } } );