Currently, we adjust the adjust the transform of layer entities to account for the following:
bevy_ecs_tilemap anchoring tiles to their center (we need to cancel this out to make all layers of different sizes stack on top of each other nicely)
layer offset values
However, for more niche cases of using a layer grid size that differs from the tileset tile size, this isn't sufficient. We also need to adjust the layer's transform to account for the following:
the difference between the layer size and grid size causing tiles to sink below the origin with default pivot
tiles having an in-LDtk pivot (anchor) value (which makes no difference when tile size = grid size)
This PR makes these additional adjustments. It also makes some stylistic changes that I hope will make some of the mathematical logic more clear.
The plugin still doesn't handle cases where tile size is not divisible by grid size. LDtk does spit out a warning in these scenarios though, so I think it is more reasonable to leave this unsupported for the time being.
Closes #248
Currently, we adjust the adjust the transform of layer entities to account for the following:
However, for more niche cases of using a layer grid size that differs from the tileset tile size, this isn't sufficient. We also need to adjust the layer's transform to account for the following:
This PR makes these additional adjustments. It also makes some stylistic changes that I hope will make some of the mathematical logic more clear.
The plugin still doesn't handle cases where tile size is not divisible by grid size. LDtk does spit out a warning in these scenarios though, so I think it is more reasonable to leave this unsupported for the time being.