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

feat: Add support for isometric staggered maps #1895

Merged
merged 11 commits into from
Sep 13, 2022

Conversation

jtmcdole
Copy link
Contributor

@jtmcdole jtmcdole commented Sep 10, 2022

Description

Adds support for Tiled's Isometric Staggered maps

  • Also fixes improper scaling on hexagonal maps.

image

Checklist

  • The title of my PR starts with a [Conventional Commit] prefix (fix:, feat:, docs: etc).
  • I have read the [Contributor Guide] and followed the process outlined for submitting PRs.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Related Issues

fixes #1893
similar to #1887 and #1882

Copy link
Member

@spydon spydon left a comment

Choose a reason for hiding this comment

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

Good stuff as always! Could you add an image to the PR description with an example of the outcome when using this?

packages/flame_tiled/lib/src/tiled_component.dart Outdated Show resolved Hide resolved
@jtmcdole
Copy link
Contributor Author

Converted to draft.

@jtmcdole jtmcdole marked this pull request as ready for review September 10, 2022 23:49
@jtmcdole
Copy link
Contributor Author

Back on the hotplate!

fixes flame-engine#1893

Also fixes improper scaling on hexagonal maps.
Cleanup: use switch statement for size.
(next up: fixing Hex staggering and tests with new assets)
note: this only works for single-atlas tile maps due to current
contraints in flame_tiled.
Second pass only needed for staggerY/X-Axis (even or odd)
@jtmcdole
Copy link
Contributor Author

Let me check on the test failure here. Now that the layer offset is in, I will update some of my tests to have layer diffs.

- RenderableGroup needs to refreshCache and hadnleResize on its
  children.
@jtmcdole
Copy link
Contributor Author

@spydon : changes in this last pull request:

  1. Merged with head and all the goodness there (groups, parallax, opacity)
  2. Fixed some minor bugs in group to call all children for refresh and handle resize
  3. cleared the sprite batches of all cached transforms when resize called.

For 3: there's multiple refreshes at head, so the maps are being painted multiple times for a perf hit. Not any more!

Copy link
Contributor

@kurtome kurtome left a comment

Choose a reason for hiding this comment

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

The geometry math is over my head, but overall makes sense to me

packages/flame_tiled/test/tiled_test.dart Outdated Show resolved Hide resolved
@spydon spydon merged commit 96be840 into flame-engine:main Sep 13, 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.

Support Tiled's Isometric Staggered
5 participants