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

How to load external tilesets? #8

Open
SolarLune opened this issue May 11, 2018 · 2 comments
Open

How to load external tilesets? #8

SolarLune opened this issue May 11, 2018 · 2 comments

Comments

@SolarLune
Copy link
Contributor

SolarLune commented May 11, 2018

Hello! I've started looking around at several TMX file loaders, and I've noticed that a lot of them (this one included) don't load external tilesets that maps / layers use.

Is there a reason for this, or is it just a missing implementation? And how would one do this with go-tmx?

Thanks for any assistance!

@salviati
Copy link
Owner

@SolarLune Hi! Based on what I see here, this shouldn't be hard to implement. I'd add a new function Map.decodeTilesets() which would check if the Tileset.Source is set and populate the Tileset by reading that file, and call it from Map.Read().

I can take a look if I can find sometime, but feel free to open a PR!

@SolarLune
Copy link
Contributor Author

Hey! I finally took a crack at this, and I ran into a bit of a roadblock - the Read() function doesn't take a direct path to the TMX file, and any external Tilesets' Source attributes are relative paths. That means there's no path to external .TSX files to load them up.

I could add a DecodeTilesets() function on the Map itself that could be called after map creation by the user with a path to the map's file, but that's a bit awkward. However, that could be called in the function that I just PR'd that loads in the map from a string path after map creation, which isn't too bad, I think.

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

2 participants