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

TmxEntity.hx has a tile loading bug #5

Open
infidel- opened this issue Jul 2, 2013 · 3 comments
Open

TmxEntity.hx has a tile loading bug #5

infidel- opened this issue Jul 2, 2013 · 3 comments
Labels

Comments

@infidel-
Copy link

infidel- commented Jul 2, 2013

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;

@MattTuttle
Copy link
Member

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.

@infidel-
Copy link
Author

infidel- commented Jul 3, 2013

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

@stvoidmain
Copy link

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.

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

No branches or pull requests

3 participants