deepnight / ldtk

Modern, lightweight and efficient 2D level editor
https://ldtk.io
MIT License
3.44k stars 192 forks source link

AutoLayerTiles Array Contains Duplicate Tile Entries for the Same Pixel Coordinates #517

Open dontpanic5 opened 3 years ago

dontpanic5 commented 3 years ago

I've been taking a look at the examples provided with the toolkit, namely Entities.ldtk and Test_file_for_API_showing_all_features.ldtk, and I've noticed that they both have duplicate tile entries that have the same "px" values.

Feel free to close this issue if this works as designed, but if so I am curious why there would be duplicates. I assume something with how the autotile rules work.

If this is not working as designed, it seems that duplicates should be filtered and removed before the JSON is written. From what I've gathered, the last definition is always the desired one.

Mathaeuz commented 2 years ago

I've been working through this as well on a project while learning LDtk.

Although there's an option to not allow duplicate tiles when placing them manually, Auto-layer rules do not seem to have a similar setting yet.

It is as you said: tiles are ordered so that front tiles are put after their counterparts within the array.

I suspect there are applications for this, for instance when working with simple export and making use of the layered output .png files, where multiple tiles are flattened.