Phaser.TileSprite = function (game, x, y, width, height, key, frame){ x = x || 0; y = y || 0; width = width || 256; height = height || 256; key = key || null ; frame = frame || null ; this.type = Phaser.TILESPRITE; this.physicsType = Phaser.SPRITE; this._scroll = new Phaser.Point(); var def = game.cache.getImage('__default', true ); PIXI.TilingSprite.call(this, new PIXI.Texture(def.base), width, height); Phaser.Component.Core.init.call(this, game, x, y, key, frame); } ; Phaser.TileSprite.prototype = Object.create(PIXI.TilingSprite.prototype); Phaser.TileSprite.prototype.constructor = Phaser.TileSprite; Phaser.Component.Core.install.call(Phaser.TileSprite.prototype, ['Angle', 'Animation', 'AutoCull', 'Bounds', 'BringToTop', 'Destroy', 'FixedToCamera', 'Health', 'InCamera', 'InputEnabled', 'InWorld', 'LifeSpan', 'LoadTexture', 'Overlap', 'PhysicsBody', 'Reset', 'Smoothed'] ); Phaser.TileSprite.prototype.preUpdatePhysics = Phaser.Component.PhysicsBody.preUpdate; Phaser.TileSprite.prototype.preUpdateLifeSpan = Phaser.Component.LifeSpan.preUpdate; Phaser.TileSprite.prototype.preUpdateInWorld = Phaser.Component.InWorld.preUpdate; Phaser.TileSprite.prototype.preUpdateCore = Phaser.Component.Core.preUpdate; Phaser.TileSprite.prototype.preUpdate = function (){ if (this._scroll.x !== 0) { this.tilePosition.x += this._scroll.x * this.game.time.physicsElapsed; } if (this._scroll.y !== 0) { this.tilePosition.y += this._scroll.y * this.game.time.physicsElapsed; } if (!this.preUpdatePhysics() || !this.preUpdateLifeSpan() || !this.preUpdateInWorld()) { return false ; } return this.preUpdateCore(); } ; Phaser.TileSprite.prototype.autoScroll = function (x, y){ this._scroll.set(x, y); } ; Phaser.TileSprite.prototype.stopScroll = function (){ this._scroll.set(0, 0); } ; Phaser.TileSprite.prototype.destroy = function (destroyChildren){ Phaser.Component.Destroy.prototype.destroy.call(this, destroyChildren); PIXI.TilingSprite.prototype.destroy.call(this); } ; Phaser.TileSprite.prototype.reset = function (x, y){ Phaser.Component.Reset.prototype.reset.call(this, x, y); this.tilePosition.x = 0; this.tilePosition.y = 0; return this; } ;