Tilemap#setLayer()

setLayer(layer) Sets the current layer to the given index. Parameters Name Type Description layer number | string | Phaser.TilemapLayer The layer to set as current. Source code: tilemap/Tilemap.js (Line 1223)

Tilemap#setCollisionByExclusion()

setCollisionByExclusion(indexes, collides, layer, recalculate) Sets collision on all tiles in the given layer, except for the IDs of those in the given array.The collides parameter controls if collision will be enabled (true) or disabled (false). Parameters Name Type Argument Default Description indexes array An array of the tile IDs to not be counted for collision. collides boolean <optional> true If true it will enable collision. If false it will clear collision. layer nu

Tilemap#setCollisionBetween()

setCollisionBetween(start, stop, collides, layer, recalculate) Sets collision on a range of tiles where the tile IDs increment sequentially.Calling this with a start value of 10 and a stop value of 14 would set collision for tiles 10, 11, 12, 13 and 14.The collides parameter controls if collision will be enabled (true) or disabled (false). Parameters Name Type Argument Default Description start number The first index of the tile to be set for collision. stop number The last index

Tilemap#setCollision()

setCollision(indexes, collides, layer, recalculate) Sets collision the given tile or tiles. You can pass in either a 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). Parameters Name Type Argument Default Description indexes number | array Either a single tile index, or an array of tile IDs to be checked for collision. collides boolean <optional> true If true it will enable co

Tilemap#searchTileIndex()

searchTileIndex(index, skip, reverse, layer) → {Phaser.Tile} Searches the entire map layer for the first tile matching the given index, then returns that Phaser.Tile object.If no match is found it returns null.The search starts from the top-left tile and continues horizontally until it hits the end of the row, then it drops down to the next column.If the reverse boolean is true, it scans starting from the bottom-right corner traveling up to the top-left. Parameters Name Type Argument Default

Tilemap#replace()

replace(source, dest, x, y, width, height, layer) Scans the given area for tiles with an index matching source and updates their index to match dest. Parameters Name Type Argument Description source number The tile index value to scan for. dest number The tile index value to replace found tiles with. x number X position of the top left of the area to operate one, given in tiles, not pixels. y number Y position of the top left of the area to operate one, given in tiles, not pi

Tilemap#removeTileWorldXY()

removeTileWorldXY(x, y, tileWidth, tileHeight, layer) → {Phaser.Tile} Removes the tile located at the given coordinates and updates the collision data. The coordinates are given in pixel values. Parameters Name Type Argument Description x number X position to insert the tile (given in pixels) y number Y position to insert the tile (given in pixels) tileWidth number The width of the tile in pixels. tileHeight number The height of the tile in pixels. layer number | string | Ph

Tilemap#removeTile()

removeTile(x, y, layer) → {Phaser.Tile} Removes the tile located at the given coordinates and updates the collision data. Parameters Name Type Argument Description x number X position to place the tile (given in tile units, not pixels) y number Y position to place the tile (given in tile units, not pixels) layer number | string | Phaser.TilemapLayer <optional> The layer to modify. Returns Phaser.Tile - The Tile object that was removed from this map. Source code: tile

Tilemap#removeAllLayers()

removeAllLayers() Removes all layers from this tile map. Source code: tilemap/Tilemap.js (Line 1876)

Tilemap#random()

random(x, y, width, height, layer) Randomises a set of tiles in a given area. Parameters Name Type Argument Description x number X position of the top left of the area to operate one, given in tiles, not pixels. y number Y position of the top left of the area to operate one, given in tiles, not pixels. width number The width in tiles of the area to operate on. height number The height in tiles of the area to operate on. layer number | string | Phaser.TilemapLayer <optio