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

Layer Ordering Problem #67

Open
elliotmr opened this issue Mar 27, 2019 · 1 comment
Open

Layer Ordering Problem #67

elliotmr opened this issue Mar 27, 2019 · 1 comment
Labels
enhancement New feature or request priority:medium Required for this release

Comments

@elliotmr
Copy link

Hi bcvery1,

It looks like you have been doing a lot of work on this library. I was doing a similar thing last year and had a few insights while implementing.

I started out, like you, with a separate types of ObjectGroups, ImageLayers, and TileLayers. Unfortunately, if you do that, it is impossible to reproduce Tiled maps correctly when drawing, because you lose the layer order between the different types. In Tiled, you can put any layer type in any order and that should be how they are drawn. The draw function now will right now iterate through all the tile layers, then all the image layers, (then presumably objectgroups and groups later). In tiled however you can intersperse all layer types in any order.

While I was struggling with this problem I realized that actually ObjectGroups, ImageLayers, TileLayers, and Groups can all be parsed into a single struct type which can then identify the type using the xml.Name.

You can see my solution here: https://github.com/elliotmr/tmx/blob/master/tmx.go#L92

There is also a pixel integration example library here:
https://github.com/elliotmr/tmx/tree/master/pixeltmx

Since I don't have time to work on my library, feel free to use any concepts from it in yours.

@elliotmr elliotmr added the enhancement New feature or request label Mar 27, 2019
@bcvery1
Copy link
Owner

bcvery1 commented Mar 27, 2019

Hey @elliotmr thanks for your input, it is much appreciated.

That sort of insight will definitely help as TilePix grows. I'll definitely take a look through your repo, thank you for the offer.

@bcvery1 bcvery1 added priority:medium Required for this release and removed priority:medium Required for this release labels Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority:medium Required for this release
Projects
None yet
Development

No branches or pull requests

2 participants