mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Corrected documentation and tidied up #4992
This commit is contained in:
parent
ffb49bdb3a
commit
a3f67973cd
1 changed files with 6 additions and 7 deletions
|
@ -5,25 +5,24 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Sets the tiles in the given rectangular area (in tile coordinates) of the layer with the
|
||||
* specified index. Tiles will be set to collide if the given index is a colliding index.
|
||||
* Collision information in the region will be recalculated.
|
||||
* Checks if the given tile coordinate is within the isometric layer bounds, or not.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.CheckIsoBounds
|
||||
* @private
|
||||
* @since 3.50.iso
|
||||
* @since 3.50.0
|
||||
*
|
||||
* @param {integer} tileX - The x coordinate, in tiles, not pixels.
|
||||
* @param {integer} tileY - The y coordinate, in tiles, not pixels.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - The Tilemap Layer to check against.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera] - The Camera to run the cull check against.
|
||||
*
|
||||
* @return {boolean} Returns `true` if the coordinates are within the iso bounds.
|
||||
*/
|
||||
var CheckIsoBounds = function (tileX,tileY,layer,camera)
|
||||
var CheckIsoBounds = function (tileX, tileY, layer, camera)
|
||||
{
|
||||
var tilemapLayer = layer.tilemapLayer;
|
||||
var cullDistances = tilemapLayer.isoCullDistances;
|
||||
var pos = tilemapLayer.tileToWorldXY(tileX,tileY,undefined,camera);
|
||||
|
||||
|
||||
// we always subtract 1/2 of the tile's height/width to make the culling distance start from the center of the tiles.
|
||||
return pos.x > camera.worldView.x + tilemapLayer.scaleX * layer.tileWidth * (- cullDistances.x - 1 / 2)
|
||||
&& pos.x < camera.worldView.right + tilemapLayer.scaleX * layer.tileWidth * (cullDistances.x - 1 / 2)
|
||||
|
|
Loading…
Reference in a new issue