mirror of
https://github.com/photonstorm/phaser
synced 2024-12-18 00:53:42 +00:00
Tilemap: adding jsdocs
This commit is contained in:
parent
1db68dfceb
commit
09224b724e
4 changed files with 38 additions and 3 deletions
|
@ -1,6 +1,17 @@
|
|||
var GetTileAt = require('./GetTileAt');
|
||||
var GetTilesWithin = require('./GetTilesWithin');
|
||||
|
||||
/**
|
||||
* Calculates interesting faces within the rectangular area specified (in tile coordinates).
|
||||
* Interesting faces are used internally for optimizing collisions against tiles. This method is
|
||||
* mostly used internally.
|
||||
*
|
||||
* @param {number} [tileX=0] - [description]
|
||||
* @param {number} [tileY=0] - [description]
|
||||
* @param {number} [width=max width based on tileX] - [description]
|
||||
* @param {number} [height=max height based on tileY] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
*/
|
||||
var CalculateFacesWithin = function (tileX, tileY, width, height, layer)
|
||||
{
|
||||
var above = null;
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
var GetTilesWithin = require('./GetTilesWithin');
|
||||
var CalculateFacesWithin = require('./CalculateFacesWithin');
|
||||
|
||||
// Copies indices, not other properties. Does not modify collisions.
|
||||
/**
|
||||
* Copies the tiles in the source rectangular area to a new destination (all specified in tile
|
||||
* coordinates). This copies all tile properties & recalculates interesting tile faces in the
|
||||
* destination region.
|
||||
*
|
||||
* @param {number} srcTileX - [description]
|
||||
* @param {number} srcTileY - [description]
|
||||
* @param {number} width - [description]
|
||||
* @param {number} height - [description]
|
||||
* @param {number} destTileX - [description]
|
||||
* @param {number} destTileY - [description]
|
||||
* @param {number} destTileY - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
*/
|
||||
|
||||
var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer)
|
||||
{
|
||||
if (srcTileX < 0) { srcTileX = 0; }
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
/**
|
||||
* Returns the tiles in the given layer that are within the camera's viewport. This is used
|
||||
* internally.
|
||||
*
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Camera} camera - [description]
|
||||
* @param {array} [outputArray] - [description]
|
||||
* @returns {array}
|
||||
*/
|
||||
var CullTiles = function (layer, camera, outputArray)
|
||||
{
|
||||
if (outputArray === undefined) { outputArray = []; }
|
||||
|
|
|
@ -14,8 +14,8 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
};
|
||||
|
||||
// Circle, Line, Rect, Triangle in world coordinates.
|
||||
// Notes: circle is not working yet - see CircleToRectangle in geom. Could possibly be optimized
|
||||
// by copying the shape and shifting it into tilemapLayer coordinates instead of shifting the tiles.
|
||||
// Note: Could possibly be optimized by copying the shape and shifting it into tilemapLayer
|
||||
// coordinates instead of shifting the tiles.
|
||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||
{
|
||||
if (shape === undefined) { return []; }
|
||||
|
|
Loading…
Reference in a new issue