bevy_ecs_ldtk icon indicating copy to clipboard operation
bevy_ecs_ldtk copied to clipboard

Entity tiles incorrectly offset

Open jwpjrdev opened this issue 1 year ago • 1 comments

This lamp entity is 3x1 in terms of tiles. It looks fine in LDtk but in game (I haven't done anything special to the entity in the code) the sprite sheet is shifted up by 1 tile, resulting in the sprite above it (a carrot in this case) to be shown, while cutting off the bottom tile.

Here's the code the entity uses. Nothing special.

#[derive(Default, Component)]
pub struct Lamp;

#[derive(Default, Bundle, LdtkEntity)]
pub struct LampBundle {
    lamp: Lamp,
    #[sprite_sheet_bundle]
    sprite_bundle: LdtkSpriteSheetBundle,
}

Ingame: Screenshot 2024-10-17 at 17 56 08 In the editor: Screenshot 2024-10-17 at 17 55 46 Screenshot 2024-10-17 at 18 07 08 Screenshot 2024-10-17 at 18 07 11

jwpjrdev avatar Oct 17 '24 22:10 jwpjrdev

Have you tried #[sprite_sheet_bundle(no_grid)]?

I had a similar problem when creating an entity that spanned more than one tile. I found the platformer example was doing something similar without issue, which is where I found the above.

Adding that worked in my case. I'm not sure what the no_grid parameter actually does though.

zachrburke avatar Nov 18 '24 20:11 zachrburke