phaser/src/gameobjects/TileSprite.js

38 lines
882 B
JavaScript
Raw Normal View History

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