2013-09-03 02:19:42 +00:00
|
|
|
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;
|
|
|
|
|
2013-09-03 03:58:30 +00:00
|
|
|
Phaser.Sprite.call(this, game, x, y, key, frame);
|
2013-09-03 02:19:42 +00:00
|
|
|
PIXI.TilingSprite.call(this);
|
|
|
|
|
2013-09-03 03:58:30 +00:00
|
|
|
this.texture = PIXI.TextureCache[key];
|
2013-09-03 02:19:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The width of the tiling sprite
|
|
|
|
*
|
|
|
|
* @property width
|
|
|
|
* @type Number
|
|
|
|
*/
|
|
|
|
this.width = width;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The height of the tiling sprite
|
|
|
|
*
|
|
|
|
* @property height
|
|
|
|
* @type Number
|
|
|
|
*/
|
|
|
|
this.height = height;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The scaling of the image that is being tiled
|
|
|
|
*
|
|
|
|
* @property tileScale
|
|
|
|
* @type Point
|
|
|
|
*/
|
|
|
|
this.tileScale = new Phaser.Point(1,1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The offset position of the image that is being tiled
|
|
|
|
*
|
|
|
|
* @property tilePosition
|
|
|
|
* @type Point
|
|
|
|
*/
|
|
|
|
this.tilePosition = new Phaser.Point(0,0);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-09-03 03:58:30 +00:00
|
|
|
// Extend Phaser.Sprite and PIXI.TilingSprite
|
|
|
|
Phaser.TileSprite.prototype = Phaser.Utils.extend(true, PIXI.TilingSprite.prototype, Phaser.Sprite.prototype);
|
2013-09-03 02:19:42 +00:00
|
|
|
Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
|
|
|
|
|
2013-09-03 03:58:30 +00:00
|
|
|
// Add our own custom methods
|