Skip to content

Add stagger map support#405

Open
darkautism wants to merge 1 commit into
StarArawn:mainfrom
darkautism:main
Open

Add stagger map support#405
darkautism wants to merge 1 commit into
StarArawn:mainfrom
darkautism:main

Conversation

@darkautism
Copy link
Copy Markdown

Support staggered map.
See #403

@rparrett
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread examples/helpers/tiled.rs
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
Copy Markdown
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
Copy Markdown
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