Solve the error when parsing tmx file on Web.

This commit is contained in:
zhangbin
2016-05-12 14:47:21 +08:00
parent 53dde5d944
commit 12b60e0112
+1 -1
View File
@@ -152,7 +152,7 @@ cc.TMXTilesetInfo = cc._Class.extend(/** @lends cc.TMXTilesetInfo# */{
rect.height = this._tileSize.height;
gid &= cc.TiledMap.TileFlag.FLIPPED_MASK;
gid = gid - parseInt(this.firstGid, 10);
var max_x = parseInt((this.imageSize.width - this.margin * 2 + this.spacing) / (this._tileSize.width + this.spacing), 10);
var max_x = parseInt((this.imageSize.width - this.margin + this.spacing) / (this._tileSize.width + this.spacing), 10);
rect.x = parseInt((gid % max_x) * (this._tileSize.width + this.spacing) + this.margin, 10);
rect.y = parseInt(parseInt(gid / max_x, 10) * (this._tileSize.height + this.spacing) + this.margin, 10);
return rect;