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 Description
index number

The tile index value to search for.

skip number <optional>
0

The number of times to skip a matching tile before returning.

reverse number <optional>
false

If true it will scan the layer in reverse, starting at the bottom-right. Otherwise it scans from the top-left.

layer number | string | Phaser.TilemapLayer <optional>

The layer to get the tile from.

Returns

The first (or n skipped) tile with the matching index.

Source code: tilemap/Tilemap.js (Line 1409)
doc_phaser
2017-02-14 11:15:31
Comments
Leave a Comment

Please login to continue.