mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
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:
parent
05e6fd1081
commit
c066ffef1b
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue