Phaser API Documentation

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


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.

If no layer is specified, the maps current layer is used.


name type arguments description
indexes Array.<number>

An array of the tile indexes to not be counted 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.

Since: 3.0.0
Source: src/tilemaps/Tilemap.js (Line 2119)