TilemapParser will now throw a warning if the tileset image isn't the right size for the tile dimensions (fixes #377)

This commit is contained in:
photonstorm
2014-02-21 16:57:45 +00:00
parent 3ac8fba9e8
commit 5a00a0ad97
4 changed files with 82 additions and 2 deletions
+1 -1
View File
@@ -365,7 +365,7 @@ Phaser.BitmapData.prototype = {
if (this._dirty)
{
// Only needed if running in WebGL, otherwise this array will never get cleared down
if (this.game.renderType == Phaser.WEBGL)
if (this.game.renderType === Phaser.WEBGL)
{
PIXI.texturesToUpdate.push(this.baseTexture);
}
+8 -1
View File
@@ -400,7 +400,14 @@ Phaser.TilemapParser = {
newSet.columns = (set.imagewidth - set.margin) / (set.tilewidth + set.spacing);
newSet.total = newSet.rows * newSet.columns;
tilesets.push(newSet);
if (newSet.rows % 1 !== 0 || newSet.columns % 1 !== 0)
{
console.warn('TileSet image dimensions do not match expected dimensions. Tileset width/height must be evenly divisible by Tilemap tile width/height.');
}
else
{
tilesets.push(newSet);
}
}
map.tilesets = tilesets;