Use the chunk's x and y in hexagonal (staggered) orientation#265
Open
maw3193 wants to merge 1 commit intokarai17:masterfrom
Open
Use the chunk's x and y in hexagonal (staggered) orientation#265maw3193 wants to merge 1 commit intokarai17:masterfrom
maw3193 wants to merge 1 commit intokarai17:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Attached is a zip of a love2d project which should show the problem and how I found a way to fix it in STI.
I've tried using an infinite map using a hexagonal tileset, and ended up with some tiles with negative x,y coordinates.
Using STI unmodified, this mysteriously caused the tiles with negative coordinates (which get put in a chunk with a negative x offset) to end up being drawn very far to the +x instead.
Looking at the code, this seemed to be because when using a staggered orientation, the chunk's x and y values aren't used.
This pull request makes it use those offsets in every orientation.
I'm not sure if this is the correct solution overall, just that it looks sensible and fixes the issue I found.
tileExample.zip
In the attached example, with my patch to STI, hexagonal tiles get drawn to the left of the screen (and you can scroll with the cursor keys and zoom with "=" and "-"). If you revert the latest commit in the Simple-Tiled-Implementation subdirectory, it'll draw those same tiles off to the right.