tiled icon indicating copy to clipboard operation
tiled copied to clipboard

using TmxEntity.loadGraphic doesn't really work

Open Senevri opened this issue 12 years ago • 0 comments

( Duplicate of #5 )

Basically, it only works if the tile layer is using the first tileset created, and thus it's Gids start at 1. otherwise, it tries to, for an example, look for Gid 35 on a 8x4 tilemap.

Hack:

var firstgid = 1;
//let's get that first gid!
for (ts in map.tilesets) {
    if (ts.imageSource.substr( -Std.string(tileset).length) == Std.string(tileset)) {
        firstgid = ts.firstGID;
    }
}

...

gid = layer.tileGIDs[row][col] - firstgid; 

Even this doesn't work when using funky things such as several tilesets using the same image - sometimes you might want to get a subsection of a tile, after all....

Senevri avatar Dec 15 '13 17:12 Senevri