tiled icon indicating copy to clipboard operation
tiled copied to clipboard

TmxEntity.hx has a tile loading bug

Open infidel- opened this issue 12 years ago • 3 comments

Line 53: gid = layer.tileGIDs[row][col] - 1;

does not take into account multiple tilesets so "- 1" is accurate only for the first tileset. In other cases we need to offset it by firstGID field of the appropriate tileset instead. The code I came up with is (replacing the line above):

// find proper tileset for this gid var firstGID = 1; for (t in map.tilesets) if (gid >= t.firstGID) firstGID = t.firstGID; gid -= firstGID;

infidel- avatar Jul 02 '13 23:07 infidel-

Yeah, multiple tilesets should have better support. I haven't looked into it fully but aren't there cases where map.tilesets need to be populated with the actual bitmap data? Maybe that's just related to width/height.

MattTuttle avatar Jul 03 '13 15:07 MattTuttle

I've no idea, I just fixed what was wrong with my test tmx.

infidel- avatar Jul 03 '13 21:07 infidel-

In rder for this to work correcty, yes, tileset need to have its image loaded, i have done that and, thanks to it, i made the map to autoload layers and even object layer with images, i used TiledImage for that, using the tileset.image and the getRect method, its working even when map hast multiple tilesets.

stvoidmain avatar May 18 '14 23:05 stvoidmain