Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
664 stars 75 forks source link

Sprite selection from multiple tiles loads the wrong tiles #151

Closed janos-r closed 1 year ago

janos-r commented 1 year ago

bevy_ecs_ldtk: 0.5 ldtk editor: 1.2.3

Short summary: When choosing a 2x2 tile sprite from the sheet, the library loads the correct tiles only under the assumption, that all the sprites in this sheet are made in the same size. But such a sheet would be effectively always selected as 1x1. In other words, choosing a sprite from several tiles is currently broken.

Example from the current platformer: 1) Choose a 2x2 selection for the chest entity. But don't select from the first or third line. Select a 2x2 starting on the second, third or any other odd line. Note: The pritesheet used here has the first line empty. image

2) save and load the platformer - the sprites loaded will be shifted one line higher. image

This is not an issue when selecting only 1x1 tiles, but it makes it impossible to use a sheet set like this: TilesetHouse That is how I encountered this issue. When loading the torii gate, you shift one line up. The same goes for most of the houses that are not starting on the first line.

Thank you for your consideration.

janos-r commented 1 year ago

Let me underline that the issue is not just the one-line shift, but that it is not possible to workaround by selecting a 2x2 one line lower. When you select a 2x2 starting from line 3, such a 2x2 would be loaded correctly. So any 2x2 on an intersection of a theoretical 2x2 grid is impossible to select.

Trouv commented 1 year ago

Thanks for the detailed report - I think this is the same issue as #105, which I originally wanted to address before 0.5 but didn't get around to it.

janos-r commented 9 months ago

Still happens in 0.8

Trouv commented 9 months ago

Have you tried #[sprite_sheet_bundle(no_grid)]? It will basically use a texture atlas with only 1 rectangle pointing to the region specified by the editor visual