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

Fix broken rendering of tilemaps with padding in atlas mode #363

Merged
merged 3 commits into from
Dec 11, 2022

Conversation

rparrett
Copy link
Collaborator

@rparrett rparrett commented Nov 29, 2022

Fixes #352

var columns was mistakenly adding rather than subtracting one side of the spacing, potentially causing the wrong tiles to be displayed. This bug was not visible in the spacing example. However, this would have produced the wrong result when spacing was greater than or equal to tile size.

sprite_sheet_x and sprite_sheet_y were not accounting for the what bevy calls the "offset" -- the spacing in the left gutter of the texture.

Before:
cargo run --example spacing --features=atlas
image

After
cargo run --example spacing --features=atlas
image

Note: the spacing example is intentionally displaying an incorrectly configured tilemap in blue.

@bzm3r bzm3r requested a review from StarArawn December 10, 2022 22:37
@bzm3r
Copy link
Collaborator

bzm3r commented Dec 10, 2022

@rparrett thanks for your patience on this; I've asked StarArawn to review, but he is currently super busy, so it may take a while!

But this does look good to me!

@StarArawn
Copy link
Owner

@rparrett Can you add a comment? Once that's done I'll get this merged! :)

@StarArawn StarArawn requested a review from bzm3r December 11, 2022 16:36
@StarArawn StarArawn merged commit 28db09a into StarArawn:main Dec 11, 2022
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

Successfully merging this pull request may close these issues.

TilemapSpacing is broken when using atlas feature
3 participants