Phaser API Documentation

  Version: 
copy(srcTileX, srcTileY, width, height, destTileX, destTileY, [recalculateFaces], [layer])

Description:

Copies the tiles in the source rectangular area to a new destination (all specified in tile coordinates) within the layer. This copies all tile properties & recalculates collision information in the destination region.

If no layer specified, the map's current layer is used. This cannot be applied to StaticTilemapLayers.

Parameters:

name type arguments Default description
srcTileX number

The x coordinate of the area to copy from, in tiles, not pixels.

srcTileY number

The y coordinate of the area to copy from, in tiles, not pixels.

width number

The width of the area to copy, in tiles, not pixels.

height number

The height of the area to copy, in tiles, not pixels.

destTileX number

The x coordinate of the area to copy to, in tiles, not pixels.

destTileY number

The y coordinate of the area to copy to, in tiles, not pixels.

recalculateFaces boolean <optional> true

true if the faces data should be recalculated.

layer string | number | Phaser.Tilemaps.TilemapLayer <optional>

The tile layer to use. If not given the current layer is used.

Returns:
Description:

Returns this, or null if the layer given was invalid.

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