phaser/src/gameobjects/TileSprite.js

54 lines
1.1 KiB
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
PIXI.TilingSprite.call(this);
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);
};
// 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;
// Add our own custom methods