Improved TilemapLayer rendering and debug rendering significantly. Cleared out some old assets and added a new map.

This commit is contained in:
photonstorm
2013-12-18 00:44:04 +00:00
parent dd7ae12271
commit 50eee95c99
20 changed files with 3400 additions and 17525 deletions
+8 -6
View File
@@ -154,20 +154,22 @@ Phaser.Cache.prototype = {
* @param {string} key - The unique key by which you will reference this object.
* @param {string} url - URL of this tile set file.
* @param {object} data - Extra tile set data.
* @param {number} tileWidth - Width of the sprite sheet.
* @param {number} tileHeight - Height of the sprite sheet.
* @param {number} tileMax - How many tiles stored in the sprite sheet.
* @param {number} tileWidth - Width of each single tile in pixels.
* @param {number} tileHeight - Height of each single tile in pixels.
* @param {number} [tileMargin=0] - If the tiles have been drawn with a margin, specify the amount here.
* @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
* @param {number} [rows=-1] - How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
* @param {number} [columns=-1] - How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
* @param {number} [total=-1] - The maximum number of tiles to extract from the image. If -1 it will extract `rows * columns` worth. You can also set a value lower than the actual number of tiles.
*/
addTileset: function (key, url, data, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing) {
addTileset: function (key, url, data, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total) {
this._tilesets[key] = { url: url, data: data, tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing };
this._tilesets[key] = { url: url, data: data, tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing, rows: rows, columns: columns, total: total };
PIXI.BaseTextureCache[key] = new PIXI.BaseTexture(data);
PIXI.TextureCache[key] = new PIXI.Texture(PIXI.BaseTextureCache[key]);
this._tilesets[key].tileData = Phaser.TilemapParser.tileset(this.game, key, tileWidth, tileHeight, tileMax, tileMargin, tileSpacing);
this._tilesets[key].tileData = Phaser.TilemapParser.tileset(this.game, key, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total);
},
+5 -5
View File
@@ -400,18 +400,18 @@ Phaser.Loader.prototype = {
* @param {number} [tileSpacing=0] - If the tiles have been drawn with spacing between them, specify the amount here.
* @param {number} [rows=-1] - How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
* @param {number} [columns=-1] - How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
* @param {number} [limit=-1] - The maximum number of tiles to extract from the image. If -1 it will extract rows * columns worth, otherwise you can set a lower limit value.
* @param {number} [total=-1] - The maximum number of tiles to extract from the image. If -1 it will extract `rows * columns` worth. You can also set a value lower than the actual number of tiles.
* @return {Phaser.Loader} This Loader instance.
*/
tileset: function (key, url, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, limit) {
tileset: function (key, url, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total) {
if (typeof tileMargin === "undefined") { tileMargin = 0; }
if (typeof tileSpacing === "undefined") { tileSpacing = 0; }
if (typeof rows === "undefined") { rows = -1; }
if (typeof columns === "undefined") { columns = -1; }
if (typeof limit === "undefined") { limit = -1; }
if (typeof total === "undefined") { total = -1; }
this.addToFileList('tileset', key, url, { tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing, rows: rows, columns: columns, limit: limit });
this.addToFileList('tileset', key, url, { tileWidth: tileWidth, tileHeight: tileHeight, tileMargin: tileMargin, tileSpacing: tileSpacing, rows: rows, columns: columns, total: total });
return this;
@@ -963,7 +963,7 @@ Phaser.Loader.prototype = {
case 'tileset':
this.game.cache.addTileset(file.key, file.url, file.data, file.tileWidth, file.tileHeight, file.tileMax, file.tileMargin, file.tileSpacing);
this.game.cache.addTileset(file.key, file.url, file.data, file.tileWidth, file.tileHeight, file.tileMargin, file.tileSpacing, file.rows, file.columns, file.total);
break;
case 'textureatlas':