-
Notifications
You must be signed in to change notification settings - Fork 20
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
Tiled layer order should help decide zIndex #285
Comments
100% agree, I would expect consistent z-index/sorting behavior between Tiled and the plugin. I think you're on track with the proposed fix 👍 |
I think I might also be able to squeeze this one into the next release as well 🤞 |
2 tasks
Whether it makes the release or not: thanks a lot for your efforts! |
eonarheim
added a commit
that referenced
this issue
Jan 14, 2022
Closes #285 This PR implements implicit z-ordering based on the Tiled editor order. Z-index can still be overridden with a custom property if desired. The first layer will start at `-1` z-index (the previous default) and will increment based on the Tiled order. Example of inserted tiles using the implicit z-index, no more custom property! ![implicit-z](https://user-images.githubusercontent.com/612071/149061200-6f0b9885-1982-4c5f-9626-740cc380991f.gif) Small-ish breaking change that moves all the optional properties to an option bag in the constructor ```typescript // New constructor const map = new TiledMapResource('path/to/map.tmx', { firstLayerZIndex: -2 }); // Old constructor const map = new TiledMapResource('path/to/map.tmx', undefined, -2); ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Right now the plugin needs us to specify a zindex property for individual inserted objects (and colliders). Tiled already provides it's own sorting system for layers. These layers are saved in order to a .tmx or .json file.
Steps to Reproduce
For demonstration purposes I've positioned a fire (child of AnimatedFire layer) on top of the fireplace (child of Overlay1 layer):
Expected Result
I would expect the Tiled layer sorting to help this plugin decide the z index for the actors. Currently for tiles a z index is automatically decided, but this is not the actual order as the layer occurs in the map file. For actors and colliders an absolute zindex (specified in the property of the object) is needed.
Actual Result
The z index of the actor is unchanged (therefor 0) because no property is set. This causes the tiles to overlap the actor. (The tiles have their z index automatically decided starting from -1)
Current Workaround
Manually set a zindex property on each object and tile layers (this is how the examples in
./examples
avoid this problem)Proposed fix
Sadly I'm not motivated enough to create a PR, though I hope I can still aid you with a (hopefully) clear bug report and proposed fix:
Should this be fixed?
In my opinion: eventually yes. Because:
However looking at the amount of work that is required to fix this, the workaround seems a viable alternative for now.
I really hope this helps you all.
Thanks for your time and effort!
The text was updated successfully, but these errors were encountered: