phaser/src/gameobjects/TileSprite.js
2013-09-12 21:54:41 +01:00

39 lines
915 B
JavaScript

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;
Phaser.Sprite.call(this, game, x, y, key, frame);
this.texture = PIXI.TextureCache[key];
PIXI.TilingSprite.call(this, this.texture, width, height);
this.type = Phaser.TILESPRITE;
/**
* 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);
};
Phaser.TileSprite.prototype = Phaser.Utils.extend(true, PIXI.TilingSprite.prototype, Phaser.Sprite.prototype);
Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
// Add our own custom methods