Tilemap#setCollisionBetween()

setCollisionBetween(start, stop, collides, layer, recalculate)

Sets collision on a range of tiles where the tile IDs increment sequentially.
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).

Parameters
Name Type Argument Default 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>
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 880)
doc_phaser
2017-02-14 11:15:32
Comments
Leave a Comment

Please login to continue.