2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
2014-02-05 05:54:25 +00:00
|
|
|
* @copyright 2014 Photon Storm Ltd.
|
2013-10-01 12:54:29 +00:00
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2014-02-13 15:03:46 +00:00
|
|
|
* A TileSprite is a Sprite that has a repeating texture. The texture can be scrolled and scaled and will automatically wrap on the edges as it does so.
|
|
|
|
* Please note that TileSprites have no input handler or physics bodies.
|
|
|
|
*
|
|
|
|
* @class Phaser.TileSprite
|
2013-10-01 12:54:29 +00:00
|
|
|
* @constructor
|
|
|
|
* @param {Phaser.Game} game - Current game instance.
|
2014-02-13 15:03:46 +00:00
|
|
|
* @param {number} [x=0] - X position of the new tileSprite.
|
|
|
|
* @param {number} [y=0] - Y position of the new tileSprite.
|
|
|
|
* @param {number} [width=256] - the width of the tilesprite.
|
|
|
|
* @param {number} [height=256] - the height of the tilesprite.
|
2013-10-25 14:22:45 +00:00
|
|
|
* @param {string|Phaser.RenderTexture|PIXI.Texture} key - This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2014-01-02 23:28:22 +00:00
|
|
|
Phaser.TileSprite = function (game, x, y, width, height, key) {
|
2013-09-03 02:19:42 +00:00
|
|
|
|
|
|
|
x = x || 0;
|
|
|
|
y = y || 0;
|
|
|
|
width = width || 256;
|
|
|
|
height = height || 256;
|
|
|
|
key = key || null;
|
|
|
|
|
2013-11-25 03:13:04 +00:00
|
|
|
/**
|
|
|
|
* @property {PIXI.Texture} texture - The texture that the sprite renders with.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2013-09-03 03:58:30 +00:00
|
|
|
this.texture = PIXI.TextureCache[key];
|
2013-09-03 02:19:42 +00:00
|
|
|
|
2013-11-25 03:13:04 +00:00
|
|
|
PIXI.TilingSprite.call(this, this.texture, width, height);
|
2013-09-03 02:19:42 +00:00
|
|
|
|
2013-11-25 03:13:04 +00:00
|
|
|
/**
|
|
|
|
* @property {number} type - The const type of this object.
|
|
|
|
* @readonly
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
2013-11-25 03:13:04 +00:00
|
|
|
this.type = Phaser.TILESPRITE;
|
2013-09-12 20:54:41 +00:00
|
|
|
|
2014-02-13 15:03:46 +00:00
|
|
|
this.position.x = x;
|
|
|
|
this.position.y = y;
|
2013-12-17 16:48:03 +00:00
|
|
|
|
2013-09-03 02:19:42 +00:00
|
|
|
};
|
|
|
|
|
2014-02-13 15:03:46 +00:00
|
|
|
Phaser.TileSprite.prototype = Object.create(PIXI.TilingSprite.prototype);
|
2013-09-03 02:19:42 +00:00
|
|
|
Phaser.TileSprite.prototype.constructor = Phaser.TileSprite;
|