mirror of
https://github.com/photonstorm/phaser
synced 2025-01-25 19:35:15 +00:00
20 lines
487 B
JavaScript
20 lines
487 B
JavaScript
|
var TileToWorldY = function (tileY, camera, layer)
|
||
|
{
|
||
|
var tileHeight = layer.tileHeight;
|
||
|
var tilemapLayer = layer.tilemapLayer;
|
||
|
var layerWorldY = 0;
|
||
|
|
||
|
if (tilemapLayer)
|
||
|
{
|
||
|
if (camera === undefined) { camera = tilemapLayer.scene.cameras.main; }
|
||
|
|
||
|
layerWorldY = tilemapLayer.y - (camera.scrollY * tilemapLayer.scrollFactorY);
|
||
|
|
||
|
tileHeight *= tilemapLayer.scaleY;
|
||
|
}
|
||
|
|
||
|
return layerWorldY + tileY * tileHeight;
|
||
|
};
|
||
|
|
||
|
module.exports = TileToWorldY;
|