Phaser.Component.FixedToCamera = function (){ } ; Phaser.Component.FixedToCamera.postUpdate = function (){ if (this.fixedToCamera) { this.position.x = (this.game.camera.view.x + this.cameraOffset.x) / this.game.camera.scale.x; this.position.y = (this.game.camera.view.y + this.cameraOffset.y) / this.game.camera.scale.y; } } ; Phaser.Component.FixedToCamera.prototype = { _fixedToCamera: false , fixedToCamera: { get: function (){ return this._fixedToCamera; } , set: function (value){ if (value) { this._fixedToCamera = true ; this.cameraOffset.set(this.x, this.y); } else { this._fixedToCamera = false ; } } } , cameraOffset: new Phaser.Point()} ;