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 collision. If false it will clear collision. |
layer | number | string | Phaser.TilemapLayer | <optional> | The layer to operate on. If not given will default to this.currentLayer. | |
recalculate | boolean | <optional> | true | Recalculates the tile faces after the update. |
- Source code: tilemap/Tilemap.js (Line 842)
Please login to continue.