Skip to content

Conversation

@maw3193
Copy link

@maw3193 maw3193 commented Mar 17, 2022

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.

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.

1 participant