Phaser API Documentation

  Version: 
tileBody(tile, [options])

Description:

Creates a wrapper around a Tile that provides access to a corresponding Matter body. A tile can only have one Matter body associated with it. You can either pass in an existing Matter body for the tile or allow the constructor to create the corresponding body for you. If the Tile has a collision group (defined in Tiled), those shapes will be used to create the body. If not, the tile's rectangle bounding box will be used.

The corresponding body will be accessible on the Tile itself via Tile.physics.matterBody.

Note: not all Tiled collision shapes are supported. See Phaser.Physics.Matter.TileBody#setFromTileCollision for more information.

Parameters:

name type arguments description
tile Phaser.Tilemaps.Tile

The target tile that should have a Matter body.

options Phaser.Types.Physics.Matter.MatterTileOptions <optional>

Options to be used when creating the Matter body.

Returns:
Description:

The Matter Tile Body Game Object.

Since: 3.0.0