The HexagonalTileToWorldXY function incorrectly used this instead of layer causing it to error in hex tilemaps with x axis staggering. Fix #6913

This commit is contained in:
Richard Davey 2024-10-04 15:53:27 +01:00
parent 05e6fd1081
commit c066ffef1b

View file

@ -52,15 +52,17 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
var x;
var y;
var staggerAxis = layer.staggerAxis;
var staggerIndex = layer.staggerIndex;
if (layer.staggerAxis === 'y')
if (staggerAxis === 'y')
{
x = worldX + (tileWidth * tileX) + tileWidth;
y = worldY + ((1.5 * tileY) * tileHeightHalf) + tileHeightHalf;
if (tileY % 2 === 0)
{
if (this.staggerIndex === 'odd')
if (staggerIndex === 'odd')
{
x -= tileWidthHalf;
}
@ -70,14 +72,14 @@ var HexagonalTileToWorldXY = function (tileX, tileY, point, camera, layer)
}
}
}
else if ((this.staggerAxis === 'x') && (this.staggerIndex === 'odd'))
else if ((staggerAxis === 'x') && (staggerIndex === 'odd'))
{
x = worldX + ((1.5 * tileX) * tileWidthHalf) + tileWidthHalf;
y = worldY + (tileHeight * tileX) + tileHeight;
if (tileX % 2 === 0)
{
if (this.staggerIndex === 'odd')
if (staggerIndex === 'odd')
{
y -= tileHeightHalf;
}