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.
If no layer specified, the map's current layer is used.
name | type | arguments | description |
---|---|---|---|
callback | EachTileCallback |
The callback. Each tile in the given area will be passed to this callback as the first and only parameter. |
|
context | object | <optional> |
The context under which the callback should be run. |
tileX | number | <optional> |
The left most tile index (in tile coordinates) to use as the origin of the area to search. |
tileY | number | <optional> |
The top most tile index (in tile coordinates) to use as the origin of the area to search. |
width | number | <optional> |
How many tiles wide from the |
height | number | <optional> |
How many tiles tall from the |
filteringOptions | Phaser.Types.Tilemaps.FilteringOptions | <optional> |
Optional filters to apply when getting the tiles. |
layer | string | number | Phaser.Tilemaps.TilemapLayer | <optional> |
The Tile layer to run the search on. If not provided will use the current layer. |
Returns this, or null if the layer given was invalid.