Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity tiles incorrectly offset #337

Open
jwpjrdev opened this issue Oct 17, 2024 · 1 comment
Open

Entity tiles incorrectly offset #337

jwpjrdev opened this issue Oct 17, 2024 · 1 comment

Comments

@jwpjrdev
Copy link

jwpjrdev commented Oct 17, 2024

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

@zachrburke
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants