mirror of
https://github.com/photonstorm/phaser
synced 2025-02-18 06:58:30 +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
|
* 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.
|
* 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} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var CalculateFacesAt = function (tileX, tileY, layer)
|
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
|
* layer. Interesting faces are used internally for optimizing collisions against tiles. This method
|
||||||
* is mostly used internally.
|
* is mostly used internally.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.CalculateFacesWithin
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [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)
|
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
|
* coordinates) within the layer. This copies all tile properties & recalculates collision
|
||||||
* information in the destination region.
|
* information in the destination region.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.Copy
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} srcTileX - [description]
|
* @param {integer} srcTileX - [description]
|
||||||
* @param {integer} srcTileY - [description]
|
* @param {integer} srcTileY - [description]
|
||||||
* @param {integer} width - [description]
|
* @param {integer} width - [description]
|
||||||
|
@ -14,7 +17,7 @@ var CalculateFacesWithin = require('./CalculateFacesWithin');
|
||||||
* @param {integer} destTileY - [description]
|
* @param {integer} destTileY - [description]
|
||||||
* @param {integer} destTileY - [description]
|
* @param {integer} destTileY - [description]
|
||||||
* @param {boolean} [recalculateFaces=true] - [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)
|
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
|
* 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.
|
* 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} 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
|
* @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
|
* 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.
|
* one-to-one mapping with the indexes array.
|
||||||
* @param {object} spriteConfig - The config object to pass into the Sprite creator (i.e.
|
* @param {object} spriteConfig - The config object to pass into the Sprite creator (i.e.
|
||||||
* scene.make.sprite).
|
* scene.make.sprite).
|
||||||
* @param {Scene} [scene=scene the map is within] - The Scene to create the Sprites within.
|
* @param {Phaser.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 {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - The Camera to use when determining the world XY
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Sprite[]} An array of the Sprites that were created.
|
*
|
||||||
|
* @return {Phaser.GameObjects.Sprite[]} An array of the Sprites that were created.
|
||||||
*/
|
*/
|
||||||
var CreateFromTiles = function (indexes, replacements, spriteConfig, scene, camera, layer)
|
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
|
* Returns the tiles in the given layer that are within the camera's viewport. This is used
|
||||||
* internally.
|
* internally.
|
||||||
*
|
*
|
||||||
* @param {LayerData} layer - [description]
|
* @function Phaser.Tilemaps.Components.CullTiles
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {array} [outputArray] - [description]
|
* @param {array} [outputArray] - [description]
|
||||||
* @return {Tile[]}
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile[]}
|
||||||
*/
|
*/
|
||||||
var CullTiles = function (layer, camera, outputArray)
|
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.
|
* specified index. Tiles will be set to collide if the given index is a colliding index.
|
||||||
* Collision information in the region will be recalculated.
|
* Collision information in the region will be recalculated.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.Fill
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} index - [description]
|
* @param {integer} index - [description]
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [description]
|
* @param {integer} [height=max height based on tileY] - [description]
|
||||||
* @param {boolean} [recalculateFaces=true] - [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)
|
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
|
* 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.
|
* 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
|
* @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
|
* callback as the first and only parameter. The callback should return true for tiles that pass the
|
||||||
* filter.
|
* filter.
|
||||||
|
@ -20,8 +23,9 @@ var GetTilesWithin = require('./GetTilesWithin');
|
||||||
* on at least one side.
|
* on at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* have at least one interesting face.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile[]} The filtered array of Tiles.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile[]} The filtered array of Tiles.
|
||||||
*/
|
*/
|
||||||
var FilterTiles = function (callback, context, tileX, tileY, width, height, filteringOptions, layer)
|
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
|
* If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to
|
||||||
* the top-left.
|
* the top-left.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.FindByIndex
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} index - The tile index value to search for.
|
* @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 {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
|
* @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.
|
* bottom-right. Otherwise it scans from the top-left.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile|null} The first (or n skipped) tile with the matching index.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile|null} The first (or n skipped) tile with the matching index.
|
||||||
*/
|
*/
|
||||||
var FindByIndex = function (findIndex, skip, reverse, layer)
|
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
|
* satisfies the provided testing function. I.e. finds the first tile for which `callback` returns
|
||||||
* true. Similar to Array.prototype.find in vanilla JS.
|
* 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
|
* @param {function} callback - The callback. Each tile in the given area will be passed to this
|
||||||
* callback as the first and only parameter.
|
* callback as the first and only parameter.
|
||||||
* @param {object} [context] - The context under which the callback should be run.
|
* @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.
|
* on at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* have at least one interesting face.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile|null} A Tile that matches the search, or null if no Tile found
|
*
|
||||||
|
* @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)
|
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
|
* 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.
|
* 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
|
* @param {function} callback - The callback. Each tile in the given area will be passed to this
|
||||||
* callback as the first and only parameter.
|
* callback as the first and only parameter.
|
||||||
* @param {object} [context] - The context under which the callback should be run.
|
* @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.
|
* on at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* 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)
|
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.
|
* 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} 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 {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
|
* @param {boolean} [nonNull=false] - If true getTile won't return null for empty tiles, but a Tile
|
||||||
* object with an index of -1.
|
* object with an index of -1.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||||
* were invalid.
|
* were invalid.
|
||||||
*/
|
*/
|
||||||
var GetTileAt = function (tileX, tileY, nonNull, layer)
|
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.
|
* 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} 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 {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
|
* @param {boolean} [nonNull=false] - If true, function won't return null for empty tiles, but a Tile
|
||||||
* object with an index of -1.
|
* object with an index of -1.
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The tile at the given coordinates or null if no tile was found or the coordinates
|
||||||
* were invalid.
|
* were invalid.
|
||||||
*/
|
*/
|
||||||
var GetTileAtWorldXY = function (worldX, worldY, nonNull, camera, layer)
|
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.
|
* 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} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
|
@ -14,8 +17,9 @@ var GetFastValue = require('../../utils/object/GetFastValue');
|
||||||
* at least one side.
|
* at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* have at least one interesting face.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile[]} Array of Tile objects.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||||
*/
|
*/
|
||||||
var GetTilesWithin = function (tileX, tileY, width, height, filteringOptions, layer)
|
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,
|
* 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.
|
* 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 {object} [filteringOptions] - Optional filters to apply when getting the tiles.
|
||||||
* @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have
|
* @param {boolean} [filteringOptions.isNotEmpty=false] - If true, only return tiles that don't have
|
||||||
* -1 for an index.
|
* -1 for an index.
|
||||||
|
@ -27,9 +30,10 @@ var TriangleToRectangle = function (triangle, rect)
|
||||||
* at least one side.
|
* at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* have at least one interesting face.
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile[]} Array of Tile objects.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||||
*/
|
*/
|
||||||
var GetTilesWithinShape = function (shape, filteringOptions, camera, layer)
|
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.
|
* 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} worldX - [description]
|
||||||
* @param {number} worldY - [description]
|
* @param {number} worldY - [description]
|
||||||
* @param {number} width - [description]
|
* @param {number} width - [description]
|
||||||
|
@ -16,9 +19,10 @@ var WorldToTileY = require('./WorldToTileY');
|
||||||
* at least one side.
|
* at least one side.
|
||||||
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
* @param {boolean} [filteringOptions.hasInterestingFace=false] - If true, only return tiles that
|
||||||
* have at least one interesting face.
|
* have at least one interesting face.
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile[]} Array of Tile objects.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile[]} Array of Tile objects.
|
||||||
*/
|
*/
|
||||||
var GetTilesWithinWorldXY = function (worldX, worldY, width, height, filteringOptions, camera, layer)
|
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
|
* 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.
|
* 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} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
var HasTileAt = function (tileX, tileY, layer)
|
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
|
* 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.
|
* 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} worldX - [description]
|
||||||
* @param {number} worldY - [description]
|
* @param {number} worldY - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
var HasTileAtWorldXY = function (worldX, worldY, camera, layer)
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
/**
|
/**
|
||||||
* Checks if the given tile coordinates are within the bounds of the layer.
|
* 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} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
var IsInLayerBounds = function (tileX, tileY, layer)
|
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.
|
* 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.
|
* 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} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {boolean} [recalculateFaces=true] - [description]
|
* @param {boolean} [recalculateFaces=true] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The Tile object that was created or added to this map.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||||
*/
|
*/
|
||||||
var PutTileAt = function (tile, tileX, tileY, recalculateFaces, layer)
|
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
|
* 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.
|
* 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} worldX - [description]
|
||||||
* @param {integer} worldY - [description]
|
* @param {integer} worldY - [description]
|
||||||
* @param {boolean} [recalculateFaces=true] - [description]
|
* @param {boolean} [recalculateFaces=true] - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The Tile object that was created or added to this map.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The Tile object that was created or added to this map.
|
||||||
*/
|
*/
|
||||||
var PutTileAtWorldXY = function (tile, worldX, worldY, recalculateFaces, camera, layer)
|
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
|
* index at the specified location will be changed. Collision information will be recalculated
|
||||||
* within the region tiles were changed.
|
* 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.
|
* or tile indexes to place.
|
||||||
* @param {integer} tileX - [description]
|
* @param {integer} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {boolean} [recalculateFaces=true] - [description]
|
* @param {boolean} [recalculateFaces=true] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var PutTilesAt = function (tilesArray, tileX, tileY, recalculateFaces, layer)
|
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
|
* 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
|
* 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 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.
|
* 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} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [description]
|
* @param {integer} [height=max height based on tileY] - [description]
|
||||||
* @param {integer[]} [indexes] - An array of indexes to randomly draw from during randomization.
|
* @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)
|
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
|
* Removes the tile at the given tile coordinates in the specified layer and updates the layer's
|
||||||
* collision information.
|
* 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} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified
|
* @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.
|
* location with null instead of a Tile with an index of -1.
|
||||||
* @param {boolean} [recalculateFaces=true] - [description]
|
* @param {boolean} [recalculateFaces=true] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The Tile object that was removed.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||||
*/
|
*/
|
||||||
var RemoveTileAt = function (tileX, tileY, replaceWithNull, recalculateFaces, layer)
|
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
|
* Removes the tile at the given world coordinates in the specified layer and updates the layer's
|
||||||
* collision information.
|
* 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} worldX - [description]
|
||||||
* @param {number} worldY - [description]
|
* @param {number} worldY - [description]
|
||||||
* @param {boolean} [replaceWithNull=true] - If true, this will replace the tile at the specified
|
* @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.
|
* location with null instead of a Tile with an index of -1.
|
||||||
* @param {boolean} [recalculateFaces=true] - [description]
|
* @param {boolean} [recalculateFaces=true] - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Tile} The Tile object that was removed.
|
*
|
||||||
|
* @return {Phaser.Tilemaps.Tile} The Tile object that was removed.
|
||||||
*/
|
*/
|
||||||
var RemoveTileAtWorldXY = function (worldX, worldY, replaceWithNull, recalculateFaces, camera, layer)
|
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
|
* are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation
|
||||||
* wherever you want on the screen.
|
* 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 {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
|
* @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.
|
* 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.
|
* 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
|
* @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.
|
* 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)
|
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
|
* `findIndex` and updates their index to match `newIndex`. This only modifies the index and does
|
||||||
* not change collision information.
|
* not change collision information.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.ReplaceByIndex
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} findIndex - [description]
|
* @param {integer} findIndex - [description]
|
||||||
* @param {integer} newIndex - [description]
|
* @param {integer} newIndex - [description]
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [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)
|
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
|
* 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).
|
* 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 {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
|
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||||
* collision.
|
* collision.
|
||||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||||
* update.
|
* update.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetCollision = function (indexes, collides, recalculateFaces, layer)
|
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
|
* collision for tiles 10, 11, 12, 13 and 14. The `collides` parameter controls if collision will be
|
||||||
* enabled (true) or disabled (false).
|
* 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} 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 {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
|
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||||
* collision.
|
* collision.
|
||||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||||
* update.
|
* update.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetCollisionBetween = function (start, stop, collides, recalculateFaces, layer)
|
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
|
* the given array. The `collides` parameter controls if collision will be enabled (true) or
|
||||||
* disabled (false).
|
* 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 {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
|
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||||
* collision.
|
* collision.
|
||||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||||
* update.
|
* update.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetCollisionByExclusion = function (indexes, collides, recalculateFaces, layer)
|
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
|
* 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.
|
* "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
|
* @param {object} properties - An object with tile properties and corresponding values that should
|
||||||
* be checked.
|
* be checked.
|
||||||
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||||
* collision.
|
* collision.
|
||||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||||
* update.
|
* update.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetCollisionByProperty = function (properties, collides, recalculateFaces, layer)
|
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
|
* 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).
|
* 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
|
* @param {boolean} [collides=true] - If true it will enable collision. If false it will clear
|
||||||
* collision.
|
* collision.
|
||||||
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
* @param {boolean} [recalculateFaces=true] - Whether or not to recalculate the tile faces after the
|
||||||
* update.
|
* update.
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetCollisionFromCollisionGroup = function (collides, recalculateFaces, layer)
|
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
|
* 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`.
|
* 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 {integer} tileIndex - [description]
|
||||||
* @param {boolean} [collides=true] - [description]
|
* @param {boolean} [collides=true] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
*/
|
*/
|
||||||
var SetLayerCollisionIndex = function (tileIndex, collides, layer)
|
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
|
* Internally used method to set the colliding state of a tile. This does not recalculate
|
||||||
* interesting faces.
|
* 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]
|
* @param {boolean} [collides=true] - [description]
|
||||||
*/
|
*/
|
||||||
var SetTileCollision = function (tile, collides)
|
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
|
* 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.
|
* 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
|
* @param {integer|array} indexes - Either a single tile index, or an array of tile indexes to have a
|
||||||
* collision callback set for.
|
* collision callback set for.
|
||||||
* @param {function} callback - The callback that will be invoked when the tile is collided with.
|
* @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 {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)
|
var SetTileIndexCallback = function (indexes, callback, callbackContext, layer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
var GetTilesWithin = require('./GetTilesWithin');
|
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
|
* If a callback is already set for the tile index it will be replaced. Set the callback to null to
|
||||||
* remove it.
|
* remove it.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.SetTileLocationCallback
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [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 {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 {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)
|
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
|
* appear to have changed! This method only modifies tile indexes and does not change collision
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.Shuffle
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [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)
|
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
|
* `indexA` and swaps then with `indexB`. This only modifies the index and does not change collision
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.SwapByIndex
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} tileA - First tile index.
|
* @param {integer} tileA - First tile index.
|
||||||
* @param {integer} tileB - Second tile index.
|
* @param {integer} tileB - Second tile index.
|
||||||
* @param {integer} [tileX=0] - [description]
|
* @param {integer} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [description]
|
* @param {integer} [width=max width based on tileX] - [description]
|
||||||
* @param {integer} [height=max height based on tileY] - [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)
|
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
|
* Converts from tile X coordinates (tile units) to world X coordinates (pixels), factoring in the
|
||||||
* layer's position, scale and scroll.
|
* layer's position, scale and scroll.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.TileToWorldX
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} tileX - [description]
|
* @param {integer} tileX - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
var TileToWorldX = function (tileX, camera, layer)
|
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
|
* layer's position, scale and scroll. This will return a new Vector2 object or update the given
|
||||||
* `point` object.
|
* `point` object.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.TileToWorldXY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} tileX - [description]
|
* @param {integer} tileX - [description]
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {Vector2} [point] - [description]
|
* @param {Phaser.Math.Vector2} [point] - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Vector2} The XY location in world coordinates.
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} The XY location in world coordinates.
|
||||||
*/
|
*/
|
||||||
var TileToWorldXY = function (tileX, tileY, point, camera, layer)
|
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
|
* Converts from tile Y coordinates (tile units) to world Y coordinates (pixels), factoring in the
|
||||||
* layer's position, scale and scroll.
|
* layer's position, scale and scroll.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.TileToWorldY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {integer} tileY - [description]
|
* @param {integer} tileY - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
var TileToWorldY = function (tileY, camera, layer)
|
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
|
* 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.
|
* 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} [tileX=0] - [description]
|
||||||
* @param {integer} [tileY=0] - [description]
|
* @param {integer} [tileY=0] - [description]
|
||||||
* @param {integer} [width=max width based on tileX] - [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
|
* @param {object[]} [weightedIndexes] - An array of objects to randomly draw from during
|
||||||
* randomization. They should be in the form: { index: 0, weight: 4 } or
|
* 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.
|
* { 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)
|
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
|
* Converts from world X coordinates (pixels) to tile X coordinates (tile units), factoring in the
|
||||||
* layer's position, scale and scroll.
|
* layer's position, scale and scroll.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.WorldToTileX
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {number} worldX - [description]
|
* @param {number} worldX - [description]
|
||||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||||
* nearest integer.
|
* nearest integer.
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {number} The X location in tile units.
|
* @return {number} The X location in tile units.
|
||||||
*/
|
*/
|
||||||
var WorldToTileX = function (worldX, snapToFloor, camera, layer)
|
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
|
* layer's position, scale and scroll. This will return a new Vector2 object or update the given
|
||||||
* `point` object.
|
* `point` object.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.WorldToTileXY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {number} worldX - [description]
|
* @param {number} worldX - [description]
|
||||||
* @param {number} worldY - [description]
|
* @param {number} worldY - [description]
|
||||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||||
* nearest integer.
|
* nearest integer.
|
||||||
* @param {Vector2} [point] - [description]
|
* @param {Phaser.Math.Vector2} [point] - [description]
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
* @return {Vector2} The XY location in tile units.
|
*
|
||||||
|
* @return {Phaser.Math.Vector2} The XY location in tile units.
|
||||||
*/
|
*/
|
||||||
var WorldToTileXY = function (worldX, worldY, snapToFloor, point, camera, layer)
|
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
|
* Converts from world Y coordinates (pixels) to tile Y coordinates (tile units), factoring in the
|
||||||
* layer's position, scale and scroll.
|
* layer's position, scale and scroll.
|
||||||
*
|
*
|
||||||
|
* @function Phaser.Tilemaps.Components.WorldToTileY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @param {number} worldY - [description]
|
* @param {number} worldY - [description]
|
||||||
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
* @param {boolean} [snapToFloor=true] - Whether or not to round the tile coordinate down to the
|
||||||
* nearest integer.
|
* nearest integer.
|
||||||
* @param {Camera} [camera=main camera] - [description]
|
* @param {Phaser.Cameras.Scene2D.Camera} [camera=main camera] - [description]
|
||||||
* @param {LayerData} layer - [description]
|
* @param {Phaser.Tilemaps.LayerData} layer - [description]
|
||||||
|
*
|
||||||
* @return {number} The Y location in tile units.
|
* @return {number} The Y location in tile units.
|
||||||
*/
|
*/
|
||||||
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
var WorldToTileY = function (worldY, snapToFloor, camera, layer)
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
|
/**
|
||||||
|
* @namespace Phaser.Tilemaps.Components
|
||||||
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
|
CalculateFacesAt: require('./CalculateFacesAt'),
|
||||||
|
CalculateFacesWithin: require('./CalculateFacesWithin'),
|
||||||
Copy: require('./Copy'),
|
Copy: require('./Copy'),
|
||||||
CreateFromTiles: require('./CreateFromTiles'),
|
CreateFromTiles: require('./CreateFromTiles'),
|
||||||
CullTiles: require('./CullTiles'),
|
CullTiles: require('./CullTiles'),
|
||||||
Fill: require('./Fill'),
|
Fill: require('./Fill'),
|
||||||
|
FilterTiles: require('./FilterTiles'),
|
||||||
FindByIndex: require('./FindByIndex'),
|
FindByIndex: require('./FindByIndex'),
|
||||||
FindTile: require('./FindTile'),
|
FindTile: require('./FindTile'),
|
||||||
FilterTiles: require('./FilterTiles'),
|
|
||||||
ForEachTile: require('./ForEachTile'),
|
ForEachTile: require('./ForEachTile'),
|
||||||
GetTileAt: require('./GetTileAt'),
|
GetTileAt: require('./GetTileAt'),
|
||||||
GetTileAtWorldXY: require('./GetTileAtWorldXY'),
|
GetTileAtWorldXY: require('./GetTileAtWorldXY'),
|
||||||
|
@ -20,16 +26,14 @@ module.exports = {
|
||||||
PutTileAtWorldXY: require('./PutTileAtWorldXY'),
|
PutTileAtWorldXY: require('./PutTileAtWorldXY'),
|
||||||
PutTilesAt: require('./PutTilesAt'),
|
PutTilesAt: require('./PutTilesAt'),
|
||||||
Randomize: require('./Randomize'),
|
Randomize: require('./Randomize'),
|
||||||
CalculateFacesAt: require('./CalculateFacesAt'),
|
|
||||||
CalculateFacesWithin: require('./CalculateFacesWithin'),
|
|
||||||
RemoveTileAt: require('./RemoveTileAt'),
|
RemoveTileAt: require('./RemoveTileAt'),
|
||||||
RemoveTileAtWorldXY: require('./RemoveTileAtWorldXY'),
|
RemoveTileAtWorldXY: require('./RemoveTileAtWorldXY'),
|
||||||
ReplaceByIndex: require('./ReplaceByIndex'),
|
|
||||||
RenderDebug: require('./RenderDebug'),
|
RenderDebug: require('./RenderDebug'),
|
||||||
|
ReplaceByIndex: require('./ReplaceByIndex'),
|
||||||
SetCollision: require('./SetCollision'),
|
SetCollision: require('./SetCollision'),
|
||||||
SetCollisionBetween: require('./SetCollisionBetween'),
|
SetCollisionBetween: require('./SetCollisionBetween'),
|
||||||
SetCollisionByProperty: require('./SetCollisionByProperty'),
|
|
||||||
SetCollisionByExclusion: require('./SetCollisionByExclusion'),
|
SetCollisionByExclusion: require('./SetCollisionByExclusion'),
|
||||||
|
SetCollisionByProperty: require('./SetCollisionByProperty'),
|
||||||
SetCollisionFromCollisionGroup: require('./SetCollisionFromCollisionGroup'),
|
SetCollisionFromCollisionGroup: require('./SetCollisionFromCollisionGroup'),
|
||||||
SetTileIndexCallback: require('./SetTileIndexCallback'),
|
SetTileIndexCallback: require('./SetTileIndexCallback'),
|
||||||
SetTileLocationCallback: require('./SetTileLocationCallback'),
|
SetTileLocationCallback: require('./SetTileLocationCallback'),
|
||||||
|
|
|
@ -15,12 +15,28 @@ var TilemapComponents = require('../components');
|
||||||
* features.
|
* features.
|
||||||
*
|
*
|
||||||
* @class DynamicTilemapLayer
|
* @class DynamicTilemapLayer
|
||||||
|
* @extends Phaser.GameObjects.GameObject
|
||||||
|
* @memberOf Phaser.Tilemaps
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Scene} scene - [description]
|
* @extends Phaser.GameObjects.Components.Alpha
|
||||||
* @param {Tilemap} tilemap - The Tilemap this layer is a part of.
|
* @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 {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} [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.
|
* @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.
|
* 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;
|
this.isTilemap = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Tilemap that this layer is a part of.
|
* 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;
|
this.tilemap = tilemap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The index of the LayerData associated with this layer.
|
* 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;
|
this.layerIndex = layerIndex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The LayerData associated with this layer. LayerData can only be associated with one
|
* The LayerData associated with this layer. LayerData can only be associated with one
|
||||||
* tilemap layer.
|
* 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 = tilemap.layers[layerIndex];
|
||||||
|
|
||||||
this.layer.tilemapLayer = this; // Link the LayerData with this static tilemap layer
|
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.
|
* 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;
|
this.tileset = tileset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used internally with the canvas render. This holds the tiles that are visible within the
|
* Used internally with the canvas render. This holds the tiles that are visible within the
|
||||||
* camera.
|
* camera.
|
||||||
* @property {Tileset} culledTiles
|
*
|
||||||
|
* @name Phaser.Tilemaps.DynamicTilemapLayer#culledTiles
|
||||||
|
* @type {array}
|
||||||
|
* @since 3.0.0
|
||||||
*/
|
*/
|
||||||
this.culledTiles = [];
|
this.culledTiles = [];
|
||||||
|
|
||||||
|
@ -94,24 +129,32 @@ var DynamicTilemapLayer = new Class({
|
||||||
this.setPosition(x, y);
|
this.setPosition(x, y);
|
||||||
this.setOrigin();
|
this.setOrigin();
|
||||||
this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height);
|
this.setSize(this.layer.tileWidth * this.layer.width, this.layer.tileHeight * this.layer.height);
|
||||||
|
|
||||||
this.initPipeline('TextureTintPipeline');
|
this.initPipeline('TextureTintPipeline');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
calculateFacesAt: function (tileX, tileY)
|
||||||
{
|
{
|
||||||
TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer);
|
TilemapComponents.CalculateFacesAt(tileX, tileY, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
calculateFacesWithin: function (tileX, tileY, width, height)
|
||||||
{
|
{
|
||||||
|
@ -122,7 +165,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
createFromTiles: function (indexes, replacements, spriteConfig, scene, camera)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +178,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
cull: function (camera)
|
||||||
{
|
{
|
||||||
|
@ -142,18 +191,23 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
copy: function (srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.Copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, this.layer);
|
TilemapComponents.Copy(srcTileX, srcTileY, width, height, destTileX, destTileY, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys this DynamicTilemapLayer and removes its link to the associated LayerData.
|
* 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 ()
|
destroy: function ()
|
||||||
{
|
{
|
||||||
|
@ -162,28 +216,37 @@ var DynamicTilemapLayer = new Class({
|
||||||
{
|
{
|
||||||
this.layer.tilemapLayer = undefined;
|
this.layer.tilemapLayer = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tilemap = undefined;
|
this.tilemap = undefined;
|
||||||
this.layer = undefined;
|
this.layer = undefined;
|
||||||
this.tileset = undefined;
|
this.tileset = undefined;
|
||||||
this.culledTiles.length = 0;
|
this.culledTiles.length = 0;
|
||||||
|
|
||||||
GameObject.prototype.destroy.call(this);
|
GameObject.prototype.destroy.call(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
fill: function (index, tileX, tileY, width, height, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, this.layer);
|
TilemapComponents.Fill(index, tileX, tileY, width, height, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
filterTiles: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +256,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
findByIndex: function (findIndex, skip, reverse)
|
||||||
{
|
{
|
||||||
|
@ -203,7 +269,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
findTile: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||||
{
|
{
|
||||||
|
@ -213,7 +282,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
forEachTile: function (callback, context, tileX, tileY, width, height, filteringOptions)
|
||||||
{
|
{
|
||||||
|
@ -224,7 +296,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
getTileAt: function (tileX, tileY, nonNull)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +309,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
getTileAtWorldXY: function (worldX, worldY, nonNull, camera)
|
||||||
{
|
{
|
||||||
|
@ -244,7 +322,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
getTilesWithin: function (tileX, tileY, width, height, filteringOptions)
|
||||||
{
|
{
|
||||||
|
@ -254,7 +335,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
getTilesWithinShape: function (shape, filteringOptions, camera)
|
||||||
{
|
{
|
||||||
|
@ -264,7 +348,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
getTilesWithinWorldXY: function (worldX, worldY, width, height, filteringOptions, camera)
|
||||||
{
|
{
|
||||||
|
@ -274,6 +361,9 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAt
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
hasTileAt: function (tileX, tileY)
|
hasTileAt: function (tileX, tileY)
|
||||||
|
@ -284,6 +374,9 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#hasTileAtWorldXY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
hasTileAtWorldXY: function (worldX, worldY, camera)
|
hasTileAtWorldXY: function (worldX, worldY, camera)
|
||||||
|
@ -294,7 +387,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
putTileAt: function (tile, tileX, tileY, recalculateFaces)
|
||||||
{
|
{
|
||||||
|
@ -304,7 +400,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
putTileAtWorldXY: function (tile, worldX, worldY, recalculateFaces, camera)
|
||||||
{
|
{
|
||||||
|
@ -314,29 +413,40 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
putTilesAt: function (tilesArray, tileX, tileY, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
TilemapComponents.PutTilesAt(tilesArray, tileX, tileY, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
randomize: function (tileX, tileY, width, height, indexes)
|
||||||
{
|
{
|
||||||
TilemapComponents.Randomize(tileX, tileY, width, height, indexes, this.layer);
|
TilemapComponents.Randomize(tileX, tileY, width, height, indexes, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
removeTileAt: function (tileX, tileY, replaceWithNull, recalculateFaces)
|
||||||
{
|
{
|
||||||
|
@ -346,7 +456,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
removeTileAtWorldXY: function (worldX, worldY, replaceWithNull, recalculateFaces, camera)
|
||||||
{
|
{
|
||||||
|
@ -356,127 +469,174 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
renderDebug: function (graphics, styleConfig)
|
||||||
{
|
{
|
||||||
TilemapComponents.RenderDebug(graphics, styleConfig, this.layer);
|
TilemapComponents.RenderDebug(graphics, styleConfig, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
replaceByIndex: function (findIndex, newIndex, tileX, tileY, width, height)
|
||||||
{
|
{
|
||||||
TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, this.layer);
|
TilemapComponents.ReplaceByIndex(findIndex, newIndex, tileX, tileY, width, height, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setCollision: function (indexes, collides, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer);
|
TilemapComponents.SetCollision(indexes, collides, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setCollisionBetween: function (start, stop, collides, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer);
|
TilemapComponents.SetCollisionBetween(start, stop, collides, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setCollisionByProperty: function (properties, collides, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer);
|
TilemapComponents.SetCollisionByProperty(properties, collides, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setCollisionByExclusion: function (indexes, collides, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer);
|
TilemapComponents.SetCollisionByExclusion(indexes, collides, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setCollisionFromCollisionGroup: function (collides, recalculateFaces)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer);
|
TilemapComponents.SetCollisionFromCollisionGroup(collides, recalculateFaces, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setTileIndexCallback: function (indexes, callback, callbackContext)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer);
|
TilemapComponents.SetTileIndexCallback(indexes, callback, callbackContext, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
setTileLocationCallback: function (tileX, tileY, width, height, callback, callbackContext)
|
||||||
{
|
{
|
||||||
TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer);
|
TilemapComponents.SetTileLocationCallback(tileX, tileY, width, height, callback, callbackContext, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
shuffle: function (tileX, tileY, width, height)
|
||||||
{
|
{
|
||||||
TilemapComponents.Shuffle(tileX, tileY, width, height, this.layer);
|
TilemapComponents.Shuffle(tileX, tileY, width, height, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
swapByIndex: function (indexA, indexB, tileX, tileY, width, height)
|
||||||
{
|
{
|
||||||
TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, this.layer);
|
TilemapComponents.SwapByIndex(indexA, indexB, tileX, tileY, width, height, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldX
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
tileToWorldX: function (tileX, camera)
|
tileToWorldX: function (tileX, camera)
|
||||||
|
@ -487,6 +647,9 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
tileToWorldY: function (tileY, camera)
|
tileToWorldY: function (tileY, camera)
|
||||||
|
@ -497,7 +660,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
* @return {Vector2}
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#tileToWorldXY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
|
* @return {Phaser.Math.Vector2}
|
||||||
*/
|
*/
|
||||||
tileToWorldXY: function (tileX, tileY, point, camera)
|
tileToWorldXY: function (tileX, tileY, point, camera)
|
||||||
{
|
{
|
||||||
|
@ -507,17 +673,24 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
weightedRandomize: function (tileX, tileY, width, height, weightedIndexes)
|
||||||
{
|
{
|
||||||
TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, this.layer);
|
TilemapComponents.WeightedRandomize(tileX, tileY, width, height, weightedIndexes, this.layer);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileX
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
worldToTileX: function (worldX, snapToFloor, camera)
|
worldToTileX: function (worldX, snapToFloor, camera)
|
||||||
|
@ -528,6 +701,9 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* See component documentation.
|
||||||
*
|
*
|
||||||
|
* @method Phaser.Tilemaps.DynamicTilemapLayer#worldToTileXY
|
||||||
|
* @since 3.0.0
|
||||||
|
*
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
worldToTileY: function (worldY, snapToFloor, camera)
|
worldToTileY: function (worldY, snapToFloor, camera)
|
||||||
|
@ -538,7 +714,10 @@ var DynamicTilemapLayer = new Class({
|
||||||
/**
|
/**
|
||||||
* See component documentation.
|
* 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)
|
worldToTileXY: function (worldX, worldY, snapToFloor, point, camera)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
|
Components: require('components/'),
|
||||||
|
|
||||||
Formats: require('./Formats'),
|
Formats: require('./Formats'),
|
||||||
ImageCollection: require('./ImageCollection'),
|
ImageCollection: require('./ImageCollection'),
|
||||||
ParseToTilemap: require('./ParseToTilemap'),
|
ParseToTilemap: require('./ParseToTilemap'),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var Class = require('../../utils/Class');
|
var Class = require('../../utils/Class');
|
||||||
var GameObject = require('../../gameobjects/GameObject');
|
|
||||||
var Components = require('../../gameobjects/components');
|
var Components = require('../../gameobjects/components');
|
||||||
|
var GameObject = require('../../gameobjects/GameObject');
|
||||||
var StaticTilemapLayerRender = require('./StaticTilemapLayerRender');
|
var StaticTilemapLayerRender = require('./StaticTilemapLayerRender');
|
||||||
var TilemapComponents = require('../components');
|
var TilemapComponents = require('../components');
|
||||||
|
|
||||||
|
@ -14,12 +14,28 @@ var TilemapComponents = require('../components');
|
||||||
* over a DynamicTilemapLayer when you don't need either of those features.
|
* over a DynamicTilemapLayer when you don't need either of those features.
|
||||||
*
|
*
|
||||||
* @class StaticTilemapLayer
|
* @class StaticTilemapLayer
|
||||||
|
* @extends Phaser.GameObjects.GameObject
|
||||||
|
* @memberOf Phaser.Tilemaps
|
||||||
* @constructor
|
* @constructor
|
||||||
|
* @since 3.0.0
|
||||||
*
|
*
|
||||||
* @param {Scene} scene - [description]
|
* @extends Phaser.GameObjects.Components.Alpha
|
||||||
* @param {Tilemap} tilemap - The Tilemap this layer is a part of.
|
* @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 {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} [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.
|
* @param {number} [y=0] - The world y position where the top left of this layer will be placed.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue