mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 17:58:23 +00:00
Fix IsometricWorldToTileXY result
IsometricWorldToTileXY returns a tile that is offset by (-0.5, 0.5) tiles from the expected location. This fixes the function so that Tile => World => Tile conversion returns the same value.
This commit is contained in:
parent
1ebfdef9e8
commit
40ff85bdc5
1 changed files with 0 additions and 2 deletions
|
@ -50,8 +50,6 @@ var IsometricWorldToTileXY = function (worldX, worldY, snapToFloor, point, camer
|
|||
tileWidth *= tilemapLayer.scaleX;
|
||||
}
|
||||
|
||||
worldX -= tileWidth / 2;
|
||||
|
||||
var x = (snapToFloor) ? Math.floor((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2) : ((worldX / (tileWidth / 2) + worldY / (tileHeight / 2)) / 2);
|
||||
var y = (snapToFloor) ? Math.floor((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2) : ((worldY / (tileHeight / 2) - worldX / (tileWidth / 2)) / 2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue