Sets a global collision callback for the given tile index within the layer. This will affect all
tiles on this layer that have the same index. If a callback is already set for the tile index it
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
.
If no layer is specified, the maps current layer is used.
name | type | arguments | description |
---|---|---|---|
indexes | number | Array.<number> |
Either a single tile index, or an array of tile indexes to have a collision callback set for. All values should be integers. |
|
callback | function |
The callback that will be invoked when the tile is collided with. |
|
callbackContext | object |
The context under which the callback is called. |
|
layer | string | number | Phaser.Tilemaps.TilemapLayer | <optional> |
The tile layer to use. If not given the current layer is used. |
Return this Tilemap object, or null if the layer given was invalid.