Tidy return statements

This commit is contained in:
Richard Davey 2020-10-02 10:57:14 +01:00
parent ef2d4f6d7a
commit 7d39bf9217
2 changed files with 4 additions and 8 deletions

View file

@ -37,13 +37,11 @@ var HexagonalWorldToTileY = function (worldY, snapToFloor, camera, layer)
tileHeight *= tilemapLayer.scaleY;
}
var sidel = layer.hexSideLength;
var len = layer.hexSideLength;
var rowHeight = ((tileHeight - sidel) / 2 + sidel);
var rowHeight = ((tileHeight - len) / 2 + len);
return snapToFloor
? Math.floor(worldY / rowHeight)
: worldY / rowHeight;
return (snapToFloor) ? Math.floor(worldY / rowHeight) : worldY / rowHeight;
};
module.exports = HexagonalWorldToTileY;

View file

@ -37,9 +37,7 @@ var StaggeredWorldToTileY = function (worldY, snapToFloor, camera, layer)
tileHeight *= tilemapLayer.scaleY;
}
return snapToFloor
? Math.floor(worldY / (tileHeight / 2))
: worldY / (tileHeight / 2);
return (snapToFloor) ? Math.floor(worldY / (tileHeight / 2)) : worldY / (tileHeight / 2);
};
module.exports = StaggeredWorldToTileY;