bevy_ecs_ldtk icon indicating copy to clipboard operation
bevy_ecs_ldtk copied to clipboard

spacing in ldtk is interpreted as atlas

Open gusinacio opened this issue 1 year ago • 2 comments

I have a tilemap for super mario world which has 16x with 1px spacing. When use it in ldtk, it's perfect but when I export it to bevy, it's like it has been shifted 1px (like atlas). If I use the "atlas" option on ldtk, I get the same result. Screenshot 2024-03-17 at 21 05 46 Screenshot 2024-03-17 at 21 06 03 Screenshot 2024-03-17 at 21 06 22

gusinacio avatar Mar 18 '24 00:03 gusinacio

Thanks for the issue. The tileset spacing in bevy_ecs_ldtk is unfortunately a little touchy. This is mainly because there isn't a perfect mapping between spacing options in LDtk and spacing options in bevy_ecs_tilemap. LDtk has spacing and padding, while bevy_ecs_tilemap has just spacing. Or, to be completely accurate, bevy_ecs_tilemap treats spacing and padding as the same thing.

Could you try adding a 1 px transparent border around your tileset so that your LDtk settings would be spacing = 1, padding = 1?

(This needs to be more clearly documented and should probably produce a warning)

Trouv avatar Mar 20 '24 05:03 Trouv

Could you try adding a 1 px transparent border around your tileset so that your LDtk settings would be spacing = 1, padding = 1?

This was the solution. To be more specific, spacing and padding need to match. In my case, I had 5px spacing and needed to add 5px of padding.

derveloper avatar Jan 16 '25 22:01 derveloper