Skip to content

Commit 8aaa8de

Browse files
committed
Fixed issue with tilesets not updating correctly.
1 parent a1f618f commit 8aaa8de

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/tilemap/Tilemap.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,18 @@ Phaser.Tilemap.prototype = {
300300
img = this.game.cache.getImage(key);
301301
}
302302

303-
if (this.getTilesetIndex(tileset) === null && this.format === Phaser.Tilemap.TILED_JSON)
303+
var idx = this.getTilesetIndex(tileset);
304+
305+
if (idx === null && this.format === Phaser.Tilemap.TILED_JSON)
304306
{
305307
console.warn('Phaser.Tilemap.addTilesetImage: No data found in the JSON matching the tileset name: "' + key + '"');
306308
return null;
307309
}
308310

309-
if (this.tilesets[tileset])
311+
if (this.tilesets[idx])
310312
{
311-
this.tilesets[tileset].setImage(img);
312-
return this.tilesets[tileset];
313+
this.tilesets[idx].setImage(img);
314+
return this.tilesets[idx];
313315
}
314316
else
315317
{

src/tilemap/Tileset.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ Phaser.Tileset.prototype = {
177177
*/
178178
setImage: function (image) {
179179

180-
console.log('Tileset.setImage', image.width, image.height);
181180
this.image = image;
182181
this.updateTileData(image.width, image.height);
183182

@@ -217,9 +216,6 @@ Phaser.Tileset.prototype = {
217216
var rowCount = (imageHeight - this.tileMargin * 2 + this.tileSpacing) / (this.tileHeight + this.tileSpacing);
218217
var colCount = (imageWidth - this.tileMargin * 2 + this.tileSpacing) / (this.tileWidth + this.tileSpacing);
219218

220-
console.log(imageWidth, imageHeight, rowCount, colCount);
221-
console.log('ts', this.tileMargin, this.tileSpacing, 'th', this.tileWidth, this.tileHeight);
222-
223219
if (rowCount % 1 !== 0 || colCount % 1 !== 0)
224220
{
225221
console.warn("Phaser.Tileset - image tile area is not an even multiple of tile size");

0 commit comments

Comments
 (0)