mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
TileSet.getTileData()
has been updated so it will return tile data from either Tiled 1.1.x or the new Tiled 1.2.x JSON structure. Fix #3998
This commit is contained in:
parent
2d9477680b
commit
2985a97c56
2 changed files with 21 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
### Updates
|
||||
|
||||
* The Loader has been updated to handle the impact of you destroying the game instance while still processing files. It will no longer throw cache and texture related errors. Fix #4049 (thanks @pantoninho)
|
||||
* `TileSet.getTileData()` has been updated so it will return tile data from either Tiled 1.1.x or the new Tiled 1.2.x JSON structure. Fix #3998 (thanks @martin-pabst @halgorithm)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -178,6 +178,15 @@ var Tileset = new Class({
|
|||
* @since 3.0.0
|
||||
*/
|
||||
this.texCoordinates = [];
|
||||
|
||||
/**
|
||||
* A look-up map that converts between Tiled 1.1 and Tiled 1.2 tile data.
|
||||
*
|
||||
* @name Phaser.Tilemaps.Tileset#tileIndexMap
|
||||
* @type {object}
|
||||
* @since 3.14.0
|
||||
*/
|
||||
this.tileIndexMap = null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -214,7 +223,17 @@ var Tileset = new Class({
|
|||
{
|
||||
if (!this.containsTileIndex(tileIndex)) { return null; }
|
||||
|
||||
return this.tileData[tileIndex - this.firstgid];
|
||||
if (!this.tileIndexMap)
|
||||
{
|
||||
this.tileIndexMap = {};
|
||||
|
||||
for (var i = 0; i < this.tileData.length; i++)
|
||||
{
|
||||
this.tileIndexMap[this.tileData[i]['id']] = this.tileData[i];
|
||||
}
|
||||
}
|
||||
|
||||
return this.tileIndexMap[tileIndex - this.firstgid];
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue