Tilemap#setTileLocationCallback()

setTileLocationCallback(x, y, width, height, callback, callbackContext, layer)

Sets a global collision callback for the given map location within the layer. This will affect all tiles on this layer found in the given area.
If a callback is already set for the tile index it will be replaced. Set the callback to null to remove it.
If you want to set a callback for a tile at a specific location on the map then see setTileLocationCallback.

Parameters
Name Type Argument Description
x number

X position of the top left of the area to copy (given in tiles, not pixels)

y number

Y position of the top left of the area to copy (given in tiles, not pixels)

width number

The width of the area to copy (given in tiles, not pixels)

height number

The height of the area to copy (given in tiles, not pixels)

callback function

The callback that will be invoked when the tile is collided with.

callbackContext object

The context under which the callback is called.

layer number | string | Phaser.TilemapLayer <optional>

The layer to operate on. If not given will default to this.currentLayer.

Source code: tilemap/Tilemap.js (Line 810)
doc_phaser
2017-02-14 11:15:34
Comments
Leave a Comment

Please login to continue.