mirror of
https://github.com/photonstorm/phaser
synced 2024-11-26 06:30:38 +00:00
Added jsdocs
This commit is contained in:
parent
e8c12d164b
commit
cf6bbbd0fb
48 changed files with 501 additions and 145 deletions
|
@ -5,9 +5,12 @@ var GetTileAt = require('./GetTileAt');
|
|||
* faces are used internally for optimizing collisions against tiles. This method is mostly used
|
||||
* internally to optimize recalculating faces when only one tile has been changed.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.CalculateFacesAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var CalculateFacesAt = function (tileX, tileY, layer)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,14 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* layer. Interesting faces are used internally for optimizing collisions against tiles. This method
|
||||
* is mostly used internally.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.CalculateFacesWithin
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var CalculateFacesWithin = function (tileX, tileY, width, height, layer)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,9 @@ var CalculateFacesWithin = require('./CalculateFacesWithin');
|
|||
* coordinates) within the layer. This copies all tile properties & recalculates collision
|
||||
* information in the destination region.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.Copy
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} srcTileX - [description]
|
||||
* @param {integer} srcTileY - [description]
|
||||
* @param {integer} width - [description]
|
||||
|
@ -14,7 +17,7 @@ var CalculateFacesWithin = require('./CalculateFacesWithin');
|
|||
* @param {integer} destTileY - [description]
|
||||
* @param {integer} destTileY - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var Copy = function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -9,16 +9,20 @@ var ReplaceByIndex = require('./ReplaceByIndex');
|
|||
* created. This is useful if you want to lay down special tiles in a level that are converted to
|
||||
* Sprites, but want to replace the tile itself with a floor tile or similar once converted.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.CreateFromTiles
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|array} indexes - The tile index, or array of indexes, to create Sprites from.
|
||||
* @param {integer|array} replacements - The tile index, or array of indexes, to change a converted
|
||||
* tile to. Set to `null` to leave the tiles unchanged. If an array is given, it is assumed to be a
|
||||
* one-to-one mapping with the indexes array.
|
||||
* @param {object} spriteConfig - The config object to pass into the Sprite creator (i.e.
|
||||
* scene.make.sprite).
|
||||
* @param {Scene} [scene=scene the map is within] - The Scene to create the Sprites within.
|
||||
* @param {Camera} [camera=main camera] - The Camera to use when determining the world XY
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Sprite[]} An array of the Sprites that were created.
|
||||
* @param {Phaser.Scene} [scene=scene the map is within] - The Scene to create the Sprites within.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created.
|
||||
*/
|
||||
var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,14 @@
|
|||
* 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=main camera] - [description]
|
||||
* @function Phaser.Tilemaps.Components.CullTiles
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {array} [outputArray] - [description]
|
||||
* @return {Tile[]}
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]}
|
||||
*/
|
||||
var CullTiles = function (layer, camera, outputArray)
|
||||
{
|
||||
|
|
|
@ -7,13 +7,16 @@ var SetTileCollision = require('./SetTileCollision');
|
|||
* specified index. Tiles will be set to collide if the given index is a colliding index.
|
||||
* Collision information in the region will be recalculated.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.Fill
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} index - [description]
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var Fill = function (index, tileX, tileY, width, height, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* filter callback function. Any tiles that pass the filter test (i.e. where the callback returns
|
||||
* true) will returned as a new array. Similar to Array.prototype.Filter in vanilla JS.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.FilterTiles
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {function} callback - The callback. Each tile in the given area will be passed to this
|
||||
* callback as the first and only parameter. The callback should return true for tiles that pass the
|
||||
* filter.
|
||||
|
@ -20,8 +23,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* on at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile[]} The filtered array of Tiles.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles.
|
||||
*/
|
||||
var FilterTiles = function (callback, context, tileX, tileY, width, height, filteringOptions, layer)
|
||||
{
|
||||
|
|
|
@ -5,12 +5,16 @@
|
|||
* If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
|
||||
* the top-left.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.FindByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} index - The tile index value to search for.
|
||||
* @param {integer} [skip=0] - The number of times to skip a matching tile before returning.
|
||||
* @param {boolean} [reverse=false] - If true it will scan the layer in reverse, starting at the
|
||||
* bottom-right. Otherwise it scans from the top-left.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile|null} The first (or n skipped) tile with the matching index.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile|null} The first (or n skipped) tile with the matching index.
|
||||
*/
|
||||
var FindByIndex = function (findIndex, skip, reverse, layer)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
|
||||
* true. Similar to Array.prototype.find in vanilla JS.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.FindTile
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {function} callback - The callback. Each tile in the given area will be passed to this
|
||||
* callback as the first and only parameter.
|
||||
* @param {object} [context] - The context under which the callback should be run.
|
||||
|
@ -19,8 +22,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* on at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile|null} A Tile that matches the search, or null if no Tile found
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile|null} A Tile that matches the search, or null if no Tile found
|
||||
*/
|
||||
var FindTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* For each tile in the given rectangular area (in tile coordinates) of the layer, run the given
|
||||
* callback. Similar to Array.prototype.forEach in vanilla JS.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.ForEachTile
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {function} callback - The callback. Each tile in the given area will be passed to this
|
||||
* callback as the first and only parameter.
|
||||
* @param {object} [context] - The context under which the callback should be run.
|
||||
|
@ -18,7 +21,7 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* on at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var ForEachTile = function (callback, context, tileX, tileY, width, height, filteringOptions, layer)
|
||||
{
|
||||
|
|
|
@ -3,12 +3,16 @@ var IsInLayerBounds = require('./IsInLayerBounds');
|
|||
/**
|
||||
* Gets a tile at the given tile coordinates from the given layer.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.GetTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - X position to get the tile from (given in tile units, not pixels).
|
||||
* @param {integer} tileY - Y position to get the tile from (given in tile units, not pixels).
|
||||
* @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile
|
||||
* object with an index of -1.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||
* were invalid.
|
||||
*/
|
||||
var GetTileAt = function (tileX, tileY, nonNull, layer)
|
||||
|
|
|
@ -5,13 +5,17 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
/**
|
||||
* Gets a tile at the given world coordinates from the given layer.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.GetTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - X position to get the tile from (given in pixels)
|
||||
* @param {number} worldY - Y position to get the tile from (given in pixels)
|
||||
* @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile
|
||||
* object with an index of -1.
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||
* were invalid.
|
||||
*/
|
||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
||||
|
|
|
@ -3,6 +3,9 @@ var GetFastValue = require('../../utils/object/GetFastValue');
|
|||
/**
|
||||
* Gets the tiles in the given rectangular area (in tile coordinates) of the layer.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.GetTilesWithin
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
|
@ -14,8 +17,9 @@ var GetFastValue = require('../../utils/object/GetFastValue');
|
|||
* at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile[]} Array of Tile objects.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,10 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
* Gets the tiles that overlap with the given shape in the given layer. The shape must be a Circle,
|
||||
* Line, Rectangle or Triangle. The shape should be in world coordinates.
|
||||
*
|
||||
* @param {Circle|Line|Rectangle|Triangle} shape - A shape in world (pixel) coordinates
|
||||
* @function Phaser.Tilemaps.Components.GetTilesWithinShape
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Geom.Circle|Phaser.Geom.Line|Phaser.Geom.Rectangle|Phaser.Geom.Triangle} shape - A shape in world (pixel) coordinates
|
||||
* @param {object} [filteringOptions] - Optional filters to apply when getting the tiles.
|
||||
* @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have
|
||||
* -1 for an index.
|
||||
|
@ -27,9 +30,10 @@ var TriangleToRectangle = function (triangle, rect)
|
|||
* at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile[]} Array of Tile objects.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,9 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
/**
|
||||
* Gets the tiles in the given rectangular area (in world coordinates) of the layer.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.GetTilesWithinWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - [description]
|
||||
* @param {number} worldY - [description]
|
||||
* @param {number} width - [description]
|
||||
|
@ -16,9 +19,10 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* at least one side.
|
||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||
* have at least one interesting face.
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile[]} Array of Tile objects.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||
*/
|
||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
||||
{
|
||||
|
|
|
@ -4,9 +4,13 @@ var IsInLayerBounds = require('./IsInLayerBounds');
|
|||
* Checks if there is a tile at the given location (in tile coordinates) in the given layer. Returns
|
||||
* false if there is no tile or if the tile at that location has an index of -1.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.HasTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
var HasTileAt = function (tileX, tileY, layer)
|
||||
|
|
|
@ -6,10 +6,14 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns
|
||||
* false if there is no tile or if the tile at that location has an index of -1.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.HasTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - [description]
|
||||
* @param {number} worldY - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
/**
|
||||
* Checks if the given tile coordinates are within the bounds of the layer.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.IsInLayerBounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
var IsInLayerBounds = function (tileX, tileY, layer)
|
||||
|
|
|
@ -9,12 +9,16 @@ var SetTileCollision = require('./SetTileCollision');
|
|||
* location. If you pass in an index, only the index at the specified location will be changed.
|
||||
* Collision information will be recalculated at the specified location.
|
||||
*
|
||||
* @param {integer|Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @function Phaser.Tilemaps.Components.PutTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|Phaser.Tilemaps.Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The Tile object that was created or added to this map.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -8,13 +8,17 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* specified location. If you pass in an index, only the index at the specified location will be
|
||||
* changed. Collision information will be recalculated at the specified location.
|
||||
*
|
||||
* @param {integer|Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @function Phaser.Tilemaps.Components.PutTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|Phaser.Tilemaps.Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @param {integer} worldX - [description]
|
||||
* @param {integer} worldY - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The Tile object that was created or added to this map.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||
*/
|
||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
||||
{
|
||||
|
|
|
@ -8,12 +8,15 @@ var PutTileAt = require('./PutTileAt');
|
|||
* index at the specified location will be changed. Collision information will be recalculated
|
||||
* within the region tiles were changed.
|
||||
*
|
||||
* @param {integer[]|integer[][]|Tile[]|Tile[][]} tile - A row (array) or grid (2D array) of Tiles
|
||||
* @function Phaser.Tilemaps.Components.PutTilesAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer[]|integer[][]|Phaser.Tilemaps.Tile[]|Phaser.Tilemaps.Tile[][]} tile - A row (array) or grid (2D array) of Tiles
|
||||
* or tile indexes to place.
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -3,17 +3,20 @@ var GetRandomElement = require('../../utils/array/GetRandomElement');
|
|||
|
||||
/**
|
||||
* Randomizes the indexes of a rectangular region of tiles (in tile coordinates) within the
|
||||
* specified layer. Each tile will recieve a new index. If an array of indexes is passed in, then
|
||||
* specified layer. Each tile will receive a new index. If an array of indexes is passed in, then
|
||||
* those will be used for randomly assigning new tile indexes. If an array is not provided, the
|
||||
* indexes found within the region (excluding -1) will be used for randomly assigning new tile
|
||||
* indexes. This method only modifies tile indexes and does not change collision information.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.Randomize
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var Randomize = function (tileX, tileY, width, height, indexes, layer)
|
||||
{
|
||||
|
|
|
@ -6,14 +6,18 @@ var CalculateFacesAt = require('./CalculateFacesAt');
|
|||
* Removes the tile at the given tile coordinates in the specified layer and updates the layer's
|
||||
* collision information.
|
||||
*
|
||||
* @param {integer|Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @function Phaser.Tilemaps.Components.RemoveTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|Phaser.Tilemaps.Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified
|
||||
* location with null instead of a Tile with an index of -1.
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The Tile object that was removed.
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||
*/
|
||||
var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -6,15 +6,19 @@ var WorldToTileY = require('./WorldToTileY');
|
|||
* Removes the tile at the given world coordinates in the specified layer and updates the layer's
|
||||
* collision information.
|
||||
*
|
||||
* @param {integer|Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @function Phaser.Tilemaps.Components.RemoveTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|Phaser.Tilemaps.Tile} tile - The index of this tile to set or a Tile object.
|
||||
* @param {number} worldX - [description]
|
||||
* @param {number} worldY - [description]
|
||||
* @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified
|
||||
* location with null instead of a Tile with an index of -1.
|
||||
* @param {boolean} [recalculateFaces=true] - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Tile} The Tile object that was removed.
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||
*/
|
||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,10 @@ var Color = require('../../display/color');
|
|||
* are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
|
||||
* wherever you want on the screen.
|
||||
*
|
||||
* @param {Graphics} graphics - The target Graphics object to draw upon.
|
||||
* @function Phaser.Tilemaps.Components.RenderDebug
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.GameObjects.Graphics} graphics - The target Graphics object to draw upon.
|
||||
* @param {object} styleConfig - An object specifying the colors to use for the debug drawing.
|
||||
* @param {Color|null} [styleConfig.tileColor=blue] - Color to use for drawing a filled rectangle at
|
||||
* non-colliding tile locations. If set to null, non-colliding tiles will not be drawn.
|
||||
|
@ -15,7 +18,7 @@ var Color = require('../../display/color');
|
|||
* rectangle at colliding tile locations. If set to null, colliding tiles will not be drawn.
|
||||
* @param {Color|null} [styleConfig.faceColor=grey] - Color to use for drawing a line at interesting
|
||||
* tile faces. If set to null, interesting tile faces will not be drawn.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var RenderDebug = function (graphics, styleConfig, layer)
|
||||
{
|
||||
|
|
|
@ -5,13 +5,16 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* `findIndex` and updates their index to match `newIndex`. This only modifies the index and does
|
||||
* not change collision information.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.ReplaceByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} findIndex - [description]
|
||||
* @param {integer} newIndex - [description]
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var ReplaceByIndex = function (findIndex, newIndex, tileX, tileY, width, height, layer)
|
||||
{
|
||||
|
|
|
@ -7,12 +7,15 @@ var SetLayerCollisionIndex = require('./SetLayerCollisionIndex');
|
|||
* single numeric index or an array of indexes: [2, 3, 15, 20]. The `collides` parameter controls if
|
||||
* collision will be enabled (true) or disabled (false).
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetCollision
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|array} indexes - Either a single tile index, or an array of tile indexes.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||
* collision.
|
||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||
* update.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetCollision = function (indexes, collides, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -8,13 +8,16 @@ var SetLayerCollisionIndex = require('./SetLayerCollisionIndex');
|
|||
* collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
|
||||
* enabled (true) or disabled (false).
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetCollisionBetween
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} start - The first index of the tile to be set for collision.
|
||||
* @param {integer} stop - The last index of the tile to be set for collision.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||
* collision.
|
||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||
* update.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -7,12 +7,15 @@ var SetLayerCollisionIndex = require('./SetLayerCollisionIndex');
|
|||
* the given array. The `collides` parameter controls if collision will be enabled (true) or
|
||||
* disabled (false).
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetCollisionByExclusion
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer[]} indexes - An array of the tile indexes to not be counted for collision.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||
* collision.
|
||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||
* update.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -11,13 +11,16 @@ var HasValue = require('../../utils/object/HasValue');
|
|||
* also use an array of values, e.g. `{ types: ["stone", "lava", "sand" ] }`. If a tile has a
|
||||
* "types" property that matches any of those values, its collision flag will be updated.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetCollisionByProperty
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {object} properties - An object with tile properties and corresponding values that should
|
||||
* be checked.
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||
* collision.
|
||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||
* update.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetCollisionByProperty = function (properties, collides, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -7,11 +7,14 @@ var CalculateFacesWithin = require('./CalculateFacesWithin');
|
|||
* a tile's collision group, the tile's colliding information will be set. The `collides` parameter
|
||||
* controls if collision will be enabled (true) or disabled (false).
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetCollisionFromCollisionGroup
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||
* collision.
|
||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||
* update.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,12 @@
|
|||
* Internally used method to keep track of the tile indexes that collide within a layer. This
|
||||
* updates LayerData.collideIndexes to either contain or not contain the given `tileIndex`.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetLayerCollisionIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileIndex - [description]
|
||||
* @param {boolean} [collides=true] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetLayerCollisionIndex = function (tileIndex, collides, layer)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
* Internally used method to set the colliding state of a tile. This does not recalculate
|
||||
* interesting faces.
|
||||
*
|
||||
* @param {Tile} tile - [description]
|
||||
* @function Phaser.Tilemaps.Components.SetTileCollision
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Tilemaps.Tile} tile - [description]
|
||||
* @param {boolean} [collides=true] - [description]
|
||||
*/
|
||||
var SetTileCollision = function (tile, collides)
|
||||
|
|
|
@ -4,11 +4,14 @@
|
|||
* will be replaced. Set the callback to null to remove it. If you want to set a callback for a tile
|
||||
* at a specific location on the map then see setTileLocationCallback.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetTileIndexCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer|array} indexes - Either a single tile index, or an array of tile indexes to have a
|
||||
* collision callback set for.
|
||||
* @param {function} callback - The callback that will be invoked when the tile is collided with.
|
||||
* @param {object} callbackContext - The context under which the callback is called.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetTileIndexCallback = function (indexes, callback, callbackContext, layer)
|
||||
{
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
var GetTilesWithin = require('./GetTilesWithin');
|
||||
|
||||
/**
|
||||
* Sets a collision callback for the given rectangular area (in tile coordindates) within the layer.
|
||||
* Sets a collision callback for the given rectangular area (in tile coordinates) within the layer.
|
||||
* If a callback is already set for the tile index it will be replaced. Set the callback to null to
|
||||
* remove it.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SetTileLocationCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {function} callback - The callback that will be invoked when the tile is collided with.
|
||||
* @param {object} callbackContext - The context under which the callback is called.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SetTileLocationCallback = function (tileX, tileY, width, height, callback, callbackContext, layer)
|
||||
{
|
||||
|
|
|
@ -7,11 +7,14 @@ var ShuffleArray = require('../../utils/array/Shuffle');
|
|||
* appear to have changed! This method only modifies tile indexes and does not change collision
|
||||
* information.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.Shuffle
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var Shuffle = function (tileX, tileY, width, height, layer)
|
||||
{
|
||||
|
|
|
@ -5,13 +5,16 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision
|
||||
* information.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.SwapByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileA - First tile index.
|
||||
* @param {integer} tileB - Second tile index.
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
* @param {integer} [height=max height based on tileY] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var SwapByIndex = function (indexA, indexB, tileX, tileY, width, height, layer)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
* Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
|
||||
* layer's position, scale and scroll.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.TileToWorldX
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldX = function (tileX, camera, layer)
|
||||
|
|
|
@ -7,12 +7,16 @@ var Vector2 = require('../../math/Vector2');
|
|||
* layer's position, scale and scroll. This will return a new Vector2 object or update the given
|
||||
* `point` object.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.TileToWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileX - [description]
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {Vector2} [point] - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Vector2} The XY location in world coordinates.
|
||||
* @param {Phaser.Math.Vector2} [point] - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
|
||||
*/
|
||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer)
|
||||
{
|
||||
|
|
|
@ -2,9 +2,13 @@
|
|||
* Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
|
||||
* layer's position, scale and scroll.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.TileToWorldY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} tileY - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
var TileToWorldY = function (tileY, camera, layer)
|
||||
|
|
|
@ -15,6 +15,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* The probability of any index being choose is (the index's weight) / (sum of all weights). This
|
||||
* method only modifies tile indexes and does not change collision information.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.WeightedRandomize
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {integer} [tileX=0] - [description]
|
||||
* @param {integer} [tileY=0] - [description]
|
||||
* @param {integer} [width=max width based on tileX] - [description]
|
||||
|
@ -22,7 +25,7 @@ var GetTilesWithin = require('./GetTilesWithin');
|
|||
* @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during
|
||||
* randomization. They should be in the form: { index: 0, weight: 4 } or
|
||||
* { index: [0, 1], weight: 4 } if you wish to draw from multiple tile indexes.
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*/
|
||||
var WeightedRandomize = function (tileX, tileY, width, height, weightedIndexes, layer)
|
||||
{
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
* Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
|
||||
* layer's position, scale and scroll.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.WorldToTileX
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - [description]
|
||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||
* nearest integer.
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {number} The X location in tile units.
|
||||
*/
|
||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
||||
|
|
|
@ -7,14 +7,18 @@ var Vector2 = require('../../math/Vector2');
|
|||
* layer's position, scale and scroll. This will return a new Vector2 object or update the given
|
||||
* `point` object.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.WorldToTileXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldX - [description]
|
||||
* @param {number} worldY - [description]
|
||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||
* nearest integer.
|
||||
* @param {Vector2} [point] - [description]
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @return {Vector2} The XY location in tile units.
|
||||
* @param {Phaser.Math.Vector2} [point] - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {Phaser.Math.Vector2} The XY location in tile units.
|
||||
*/
|
||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
|
||||
{
|
||||
|
|
|
@ -2,11 +2,15 @@
|
|||
* Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
|
||||
* layer's position, scale and scroll.
|
||||
*
|
||||
* @function Phaser.Tilemaps.Components.WorldToTileY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} worldY - [description]
|
||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||
* nearest integer.
|
||||
* @param {Camera} [camera=main camera] - [description]
|
||||
* @param {LayerData} layer - [description]
|
||||
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||
*
|
||||
* @return {number} The Y location in tile units.
|
||||
*/
|
||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
/**
|
||||
* @namespace Phaser.Tilemaps.Components
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
CalculateFacesAt: require('./CalculateFacesAt'),
|
||||
CalculateFacesWithin: require('./CalculateFacesWithin'),
|
||||
Copy: require('./Copy'),
|
||||
CreateFromTiles: require('./CreateFromTiles'),
|
||||
CullTiles: require('./CullTiles'),
|
||||
Fill: require('./Fill'),
|
||||
FilterTiles: require('./FilterTiles'),
|
||||
FindByIndex: require('./FindByIndex'),
|
||||
FindTile: require('./FindTile'),
|
||||
FilterTiles: require('./FilterTiles'),
|
||||
ForEachTile: require('./ForEachTile'),
|
||||
GetTileAt: require('./GetTileAt'),
|
||||
GetTileAtWorldXY: require('./GetTileAtWorldXY'),
|
||||
|
@ -20,16 +26,14 @@ module.exports = {
|
|||
PutTileAtWorldXY: require('./PutTileAtWorldXY'),
|
||||
PutTilesAt: require('./PutTilesAt'),
|
||||
Randomize: require('./Randomize'),
|
||||
CalculateFacesAt: require('./CalculateFacesAt'),
|
||||
CalculateFacesWithin: require('./CalculateFacesWithin'),
|
||||
RemoveTileAt: require('./RemoveTileAt'),
|
||||
RemoveTileAtWorldXY: require('./RemoveTileAtWorldXY'),
|
||||
ReplaceByIndex: require('./ReplaceByIndex'),
|
||||
RenderDebug: require('./RenderDebug'),
|
||||
ReplaceByIndex: require('./ReplaceByIndex'),
|
||||
SetCollision: require('./SetCollision'),
|
||||
SetCollisionBetween: require('./SetCollisionBetween'),
|
||||
SetCollisionByProperty: require('./SetCollisionByProperty'),
|
||||
SetCollisionByExclusion: require('./SetCollisionByExclusion'),
|
||||
SetCollisionByProperty: require('./SetCollisionByProperty'),
|
||||
SetCollisionFromCollisionGroup: require('./SetCollisionFromCollisionGroup'),
|
||||
SetTileIndexCallback: require('./SetTileIndexCallback'),
|
||||
SetTileLocationCallback: require('./SetTileLocationCallback'),
|
||||
|
|
|
@ -15,12 +15,28 @@ var TilemapComponents = require('../components');
|
|||
* features.
|
||||
*
|
||||
* @class DynamicTilemapLayer
|
||||
* @extends Phaser.GameObjects.GameObject
|
||||
* @memberOf Phaser.Tilemaps
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Scene} scene - [description]
|
||||
* @param {Tilemap} tilemap - The Tilemap this layer is a part of.
|
||||
* @extends Phaser.GameObjects.Components.Alpha
|
||||
* @extends Phaser.GameObjects.Components.BlendMode
|
||||
* @extends Phaser.GameObjects.Components.Depth
|
||||
* @extends Phaser.GameObjects.Components.Flip
|
||||
* @extends Phaser.GameObjects.Components.GetBounds
|
||||
* @extends Phaser.GameObjects.Components.Origin
|
||||
* @extends Phaser.GameObjects.Components.Pipeline
|
||||
* @extends Phaser.GameObjects.Components.ScaleMode
|
||||
* @extends Phaser.GameObjects.Components.Size
|
||||
* @extends Phaser.GameObjects.Components.Transform
|
||||
* @extends Phaser.GameObjects.Components.Visible
|
||||
* @extends Phaser.GameObjects.Components.ScrollFactor
|
||||
*
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of.
|
||||
* @param {integer} layerIndex - The index of the LayerData associated with this layer.
|
||||
* @param {Tileset} tileset - The tileset used to render the tiles in this layer.
|
||||
* @param {Phaser.Tilemaps.Tileset} tileset - The tileset used to render the tiles in this layer.
|
||||
* @param {number} [x=0] - The world x position where the top left of this layer will be placed.
|
||||
* @param {number} [y=0] - The world y position where the top left of this layer will be placed.
|
||||
*/
|
||||
|
@ -52,41 +68,60 @@ var DynamicTilemapLayer = new Class({
|
|||
|
||||
/**
|
||||
* Used internally by physics system to perform fast type checks.
|
||||
* @property {boolean} isTilemap
|
||||
* @readonly
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#isTilemap
|
||||
* @type {boolean}
|
||||
* @readOnly
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.isTilemap = true;
|
||||
|
||||
/**
|
||||
* The Tilemap that this layer is a part of.
|
||||
* @property {Tilemap} tilemap
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#tilemap
|
||||
* @type {Phaser.Tilemaps.Tilemap}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.tilemap = tilemap;
|
||||
|
||||
/**
|
||||
* The index of the LayerData associated with this layer.
|
||||
* @property {integer} layerIndex
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#layerIndex
|
||||
* @type {integer}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.layerIndex = layerIndex;
|
||||
|
||||
/**
|
||||
* The LayerData associated with this layer. LayerData can only be associated with one
|
||||
* tilemap layer.
|
||||
* @property {LayerData} layerIndex
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#layer
|
||||
* @type {Phaser.Tilemaps.LayerData}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.layer = tilemap.layers[layerIndex];
|
||||
|
||||
this.layer.tilemapLayer = this; // Link the LayerData with this static tilemap layer
|
||||
|
||||
/**
|
||||
* The Tileset associated with this layer. A tilemap layer can only render from one Tileset.
|
||||
* @property {Tileset} tileset
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#tileset
|
||||
* @type {Phaser.Tilemaps.Tileset}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.tileset = tileset;
|
||||
|
||||
/**
|
||||
* Used internally with the canvas render. This holds the tiles that are visible within the
|
||||
* camera.
|
||||
* @property {Tileset} culledTiles
|
||||
*
|
||||
* @name Phaser.Tilemaps.DynamicTilemapLayer#culledTiles
|
||||
* @type {array}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.culledTiles = [];
|
||||
|
||||
|
@ -94,24 +129,32 @@ var DynamicTilemapLayer = new Class({
|
|||
this.setPosition(x, y);
|
||||
this.setOrigin();
|
||||
this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height);
|
||||
|
||||
this.initPipeline('TextureTintPipeline');
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
calculateFacesAt: function (tileX, tileY)
|
||||
{
|
||||
TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#calculateFacesWithin
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
calculateFacesWithin: function (tileX, tileY, width, height)
|
||||
{
|
||||
|
@ -122,7 +165,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Sprite[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#createFromTiles
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.GameObjects.Sprite[]}
|
||||
*/
|
||||
createFromTiles: function (indexes, replacements, spriteConfig, scene, camera)
|
||||
{
|
||||
|
@ -132,7 +178,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#cull
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
|
||||
*/
|
||||
cull: function (camera)
|
||||
{
|
||||
|
@ -142,18 +191,23 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#copy
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.Copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys this DynamicTilemapLayer and removes its link to the associated LayerData.
|
||||
*
|
||||
* @method Phaser.TilemapLayer#destroy
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#destroy
|
||||
* @since 3.0.0
|
||||
*/
|
||||
destroy: function ()
|
||||
{
|
||||
|
@ -162,28 +216,37 @@ var DynamicTilemapLayer = new Class({
|
|||
{
|
||||
this.layer.tilemapLayer = undefined;
|
||||
}
|
||||
|
||||
this.tilemap = undefined;
|
||||
this.layer = undefined;
|
||||
this.tileset = undefined;
|
||||
this.culledTiles.length = 0;
|
||||
|
||||
GameObject.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#fill
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
fill: function (index, tileX, tileY, width, height, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#filterTiles
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
|
||||
*/
|
||||
filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||
{
|
||||
|
@ -193,7 +256,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#findByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
findByIndex: function (findIndex, skip, reverse)
|
||||
{
|
||||
|
@ -203,7 +269,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile|null}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#findTile
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile|null}
|
||||
*/
|
||||
findTile: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||
{
|
||||
|
@ -213,7 +282,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#forEachTile
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||
{
|
||||
|
@ -224,7 +296,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
getTileAt: function (tileX, tileY, nonNull)
|
||||
{
|
||||
|
@ -234,7 +309,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#getTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
getTileAtWorldXY: function (worldX, worldY, nonNull, camera)
|
||||
{
|
||||
|
@ -244,7 +322,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithin
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
|
||||
*/
|
||||
getTilesWithin: function (tileX, tileY, width, height, filteringOptions)
|
||||
{
|
||||
|
@ -254,7 +335,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinShape
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
|
||||
*/
|
||||
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||
{
|
||||
|
@ -264,7 +348,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile[]}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#getTilesWithinWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile[]} An array of Tile objects.
|
||||
*/
|
||||
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||
{
|
||||
|
@ -274,6 +361,9 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasTileAt: function (tileX, tileY)
|
||||
|
@ -284,6 +374,9 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasTileAtWorldXY: function (worldX, worldY, camera)
|
||||
|
@ -294,7 +387,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
|
@ -304,7 +400,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#putTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera)
|
||||
{
|
||||
|
@ -314,29 +413,40 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#putTilesAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#randomize
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
randomize: function (tileX, tileY, width, height, indexes)
|
||||
{
|
||||
TilemapComponents.Randomize(tileX, tileY, width, height, indexes, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAt
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces)
|
||||
{
|
||||
|
@ -346,7 +456,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Tile}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#removeTileAtWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.Tile} A Tile object.
|
||||
*/
|
||||
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera)
|
||||
{
|
||||
|
@ -356,127 +469,174 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#renderDebug
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
renderDebug: function (graphics, styleConfig)
|
||||
{
|
||||
TilemapComponents.RenderDebug(graphics, styleConfig, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#replaceByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height)
|
||||
{
|
||||
TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setCollision
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setCollision: function (indexes, collides, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionBetween
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setCollisionBetween: function (start, stop, collides, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByProperty
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setCollisionByProperty: function (properties, collides, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionByExclusion
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setCollisionByExclusion: function (indexes, collides, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setCollisionFromCollisionGroup
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setCollisionFromCollisionGroup: function (collides, recalculateFaces)
|
||||
{
|
||||
TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setTileIndexCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setTileIndexCallback: function (indexes, callback, callbackContext)
|
||||
{
|
||||
TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#setTileLocationCallback
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext)
|
||||
{
|
||||
TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#shuffle
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
shuffle: function (tileX, tileY, width, height)
|
||||
{
|
||||
TilemapComponents.Shuffle(tileX, tileY, width, height, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#swapByIndex
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
swapByIndex: function (indexA, indexB, tileX, tileY, width, height)
|
||||
{
|
||||
TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldX
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
tileToWorldX: function (tileX, camera)
|
||||
|
@ -487,6 +647,9 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
tileToWorldY: function (tileY, camera)
|
||||
|
@ -497,7 +660,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Vector2}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Math.Vector2}
|
||||
*/
|
||||
tileToWorldXY: function (tileX, tileY, point, camera)
|
||||
{
|
||||
|
@ -507,17 +673,24 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {this}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#weightedRandomize
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Tilemaps.DynamicTilemapLayer} This Tilemap Layer object.
|
||||
*/
|
||||
weightedRandomize: function (tileX, tileY, width, height, weightedIndexes)
|
||||
{
|
||||
TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, this.layer);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileX
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
worldToTileX: function (worldX, snapToFloor, camera)
|
||||
|
@ -528,6 +701,9 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
worldToTileY: function (worldY, snapToFloor, camera)
|
||||
|
@ -538,7 +714,10 @@ var DynamicTilemapLayer = new Class({
|
|||
/**
|
||||
* See component documentation.
|
||||
*
|
||||
* @return {Vector}
|
||||
* @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileXY
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @return {Phaser.Math.Vector2}
|
||||
*/
|
||||
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
module.exports = {
|
||||
|
||||
Components: require('components/'),
|
||||
|
||||
Formats: require('./Formats'),
|
||||
ImageCollection: require('./ImageCollection'),
|
||||
ParseToTilemap: require('./ParseToTilemap'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
var Class = require('../../utils/Class');
|
||||
var GameObject = require('../../gameobjects/GameObject');
|
||||
var Components = require('../../gameobjects/components');
|
||||
var GameObject = require('../../gameobjects/GameObject');
|
||||
var StaticTilemapLayerRender = require('./StaticTilemapLayerRender');
|
||||
var TilemapComponents = require('../components');
|
||||
|
||||
|
@ -14,12 +14,28 @@ var TilemapComponents = require('../components');
|
|||
* over a DynamicTilemapLayer when you don't need either of those features.
|
||||
*
|
||||
* @class StaticTilemapLayer
|
||||
* @extends Phaser.GameObjects.GameObject
|
||||
* @memberOf Phaser.Tilemaps
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Scene} scene - [description]
|
||||
* @param {Tilemap} tilemap - The Tilemap this layer is a part of.
|
||||
* @extends Phaser.GameObjects.Components.Alpha
|
||||
* @extends Phaser.GameObjects.Components.BlendMode
|
||||
* @extends Phaser.GameObjects.Components.Depth
|
||||
* @extends Phaser.GameObjects.Components.Flip
|
||||
* @extends Phaser.GameObjects.Components.GetBounds
|
||||
* @extends Phaser.GameObjects.Components.Origin
|
||||
* @extends Phaser.GameObjects.Components.Pipeline
|
||||
* @extends Phaser.GameObjects.Components.ScaleMode
|
||||
* @extends Phaser.GameObjects.Components.Size
|
||||
* @extends Phaser.GameObjects.Components.Transform
|
||||
* @extends Phaser.GameObjects.Components.Visible
|
||||
* @extends Phaser.GameObjects.Components.ScrollFactor
|
||||
*
|
||||
* @param {Phaser.Scene} scene - [description]
|
||||
* @param {Phaser.Tilemaps.Tilemap} tilemap - The Tilemap this layer is a part of.
|
||||
* @param {integer} layerIndex - The index of the LayerData associated with this layer.
|
||||
* @param {Tileset} tileset - The tileset used to render the tiles in this layer.
|
||||
* @param {Phaser.Tilemaps.Tileset} tileset - The tileset used to render the tiles in this layer.
|
||||
* @param {number} [x=0] - The world x position where the top left of this layer will be placed.
|
||||
* @param {number} [y=0] - The world y position where the top left of this layer will be placed.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue