Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using TmxEntity.loadGraphic doesn't really work #21

Open
Senevri opened this issue Dec 15, 2013 · 0 comments
Open

using TmxEntity.loadGraphic doesn't really work #21

Senevri opened this issue Dec 15, 2013 · 0 comments

Comments

@Senevri
Copy link

Senevri commented Dec 15, 2013

( 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....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant