Phaser API Documentation

setCollisionByExclusion(indexes, [collides], [recalculateFaces])


Sets collision on all tiles in the given layer, except for tiles that have an index specified in the given array. The collides parameter controls if collision will be enabled (true) or disabled (false). Tile indexes not currently in the layer are not affected.


name type arguments Default description
indexes Array.<number>

An array of the tile indexes to not be counted for collision.

collides boolean <optional> true

If true it will enable collision. If false it will clear collision.

recalculateFaces boolean <optional> true

Whether or not to recalculate the tile faces after the update.


This Tilemap Layer object.

Since: 3.50.0