Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
697 stars 79 forks source link

spacing in ldtk is interpreted as atlas #310

Open gusinacio opened 8 months ago

gusinacio commented 8 months ago

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
Trouv commented 8 months ago

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)