2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @author Richard Davey <rich@photonstorm.com>
|
|
|
|
* @copyright 2013 Photon Storm Ltd.
|
|
|
|
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new <code>TileSprite</code>.
|
|
|
|
* @class Phaser.Tilemap
|
|
|
|
* @constructor
|
|
|
|
* @param {Phaser.Game} game - Current game instance.
|
2013-10-25 14:22:45 +00:00
|
|
|
* @param {number} x - X position of the new tileSprite.
|
|
|
|
* @param {number} y - Y position of the new tileSprite.
|
|
|
|
* @param {number} width - the width of the tilesprite.
|
|
|
|
* @param {number} height - the height of the tilesprite.
|
|
|
|
* @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.
|
|
|
|
* @param {string|number} frame - If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.
|
2013-10-01 12:54:29 +00:00
|
|
|
*/
|
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
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Description} texture - Description.
|
|
|
|
*/
|
2013-09-03 03:58:30 +00:00
|
|
|
this.texture = PIXI.TextureCache[key];
|
2013-09-03 02:19:42 +00:00
|
|
|
|
2013-09-03 05:02:47 +00:00
|
|
|
PIXI.TilingSprite.call(this, this.texture, width, height);
|
2013-09-03 02:19:42 +00:00
|
|
|
|
2013-10-01 12:54:29 +00:00
|
|
|
/**
|
|
|
|
* @property {Description} type - Description.
|
|
|
|
*/
|
2013-09-12 20:54:41 +00:00
|
|
|
this.type = Phaser.TILESPRITE;
|
|
|
|
|
2013-09-03 02:19:42 +00:00
|
|
|
/**
|
2013-10-01 12:54:29 +00:00
|
|
|
* @property {Point} tileScale - The scaling of the image that is being tiled.
|
|
|
|
*/
|
2013-09-03 05:02:47 +00:00
|
|
|
this.tileScale = new Phaser.Point(1, 1);
|
2013-09-03 02:19:42 +00:00
|
|
|
|
|
|
|
/**
|
2013-10-01 12:54:29 +00:00
|
|
|
* @property {Point} tilePosition - The offset position of the image that is being tiled.
|
|
|
|
*/
|
2013-09-03 05:02:47 +00:00
|
|
|
this.tilePosition = new Phaser.Point(0, 0);
|
2013-09-03 02:19:42 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2013-09-03 03:58:30 +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;
|
|
|
|
|
2013-09-03 03:58:30 +00:00
|
|
|
// Add our own custom methods
|