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

Add stagger map support #405

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

darkautism
Copy link

Support staggered map.
See #403

@rparrett
Copy link
Collaborator

Thanks.

I won't be able to take a close look for a few days, but just a few thoughts from a quick skim:

  • Ideally, we should depend on a tiled from crates.io. If a release isn't imminent, we can wait or do a separate PR without stagger support.
  • We should turn off compression for the example tilemap so its data is readable.
  • I think the even / odd problem must be on our side.
  • Is the file not found error from BytesResourceReader user-facing at all? I could see users potentially being confused when their files exist, but we are emitting this error because we just can't support loading sub-resources or whatever.

@darkautism
Copy link
Author

Is the file not found error from BytesResourceReader user-facing at all?

I think user will not fact file not found error because I only use this loader load a tmx. If a tmx use extern png it will load behind.
But i'm not sure TSX tileset. rs-tiled has some tileset's attribute bug so it cannot read tsx correctly.

tiled::Orientation::Hexagonal => match tiled_map.map.stagger_axis {
StaggerAxis::X => match tiled_map.map.stagger_index {
StaggerIndex::Even => {
// TODO: Why Even is Odd?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is because of how bevy handles Y coordinates. In tiled map editor Y down goes into the positive and in bevy Y down goes into the negative. When we load the tiles in we end up flipping the entire tilemap along the Y axis using: mapped_y = tiled_map.map.height - 1 - y;. Because of this we also need to "flip" the stagger.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I'm not sure what to do about that other than add a comment to explain the situation.

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.

3 participants