Phaser API Documentation

  Version: 
createBlankLayer(name, tileset, [x], [y], [width], [height], [tileWidth], [tileHeight])

Description:

Creates a new and empty Tilemap Layer. The currently selected layer in the map is set to this new layer.

Prior to v3.50.0 this method was called createBlankDynamicLayer.

Parameters:

name type arguments description
name string

The name of this layer. Must be unique within the map.

tileset string | Array.<string> | Phaser.Tilemaps.Tileset | Array.<Phaser.Tilemaps.Tileset>

The tileset, or an array of tilesets, used to render this layer. Can be a string or a Tileset object.

x number <optional>

The world x position where the top left of this layer will be placed.

y number <optional>

The world y position where the top left of this layer will be placed.

width number <optional>

The width of the layer in tiles. If not specified, it will default to the map's width.

height number <optional>

The height of the layer in tiles. If not specified, it will default to the map's height.

tileWidth number <optional>

The width of the tiles the layer uses for calculations. If not specified, it will default to the map's tileWidth.

tileHeight number <optional>

The height of the tiles the layer uses for calculations. If not specified, it will default to the map's tileHeight.

Returns:
Description:

Returns the new layer that was created, or null if it failed.

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