Sets collision on a range of tiles in a layer whose index is between the specified start
and
stop
(inclusive). 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).
If no layer is specified, the maps current layer is used.
name | type | arguments | description |
---|---|---|---|
start | number |
The first index of the tile to be set for collision. |
|
stop | number |
The last index of the tile to be set for collision. |
|
collides | boolean | <optional> |
If true it will enable collision. If false it will clear collision. |
recalculateFaces | boolean | <optional> |
Whether or not to recalculate the tile faces after the update. |
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.