Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

TileSet

Inherits: Resource < RefCounted < Object

Tile library for tilemaps.

Description

A TileSet is a library of tiles for a TileMap. A TileSet handles a list of TileSetSource, each of them storing a set of tiles.

Tiles can either be from a TileSetAtlasSource, which renders tiles out of a texture with support for physics, navigation, etc., or from a TileSetScenesCollectionSource, which exposes scene-based tiles.

Tiles are referenced by using three IDs: their source ID, their atlas coordinates ID, and their alternative tile ID.

A TileSet can be configured so that its tiles expose more or fewer properties. To do so, the TileSet resources use property layers, which you can add or remove depending on your needs.

For example, adding a physics layer allows giving collision shapes to your tiles. Each layer has dedicated properties (physics layer and mask), so you may add several TileSet physics layers for each type of collision you need.

See the functions to add new layers for more information.

Tutorials

Properties

TileLayout

tile_layout

0

TileOffsetAxis

tile_offset_axis

0

TileShape

tile_shape

0

Vector2i

tile_size

Vector2i(16, 16)

bool

uv_clipping

false

Methods

void

add_custom_data_layer(to_position: int = -1)

void

add_navigation_layer(to_position: int = -1)

void

add_occlusion_layer(to_position: int = -1)

int

add_pattern(pattern: TileMapPattern, index: int = -1)

void

add_physics_layer(to_position: int = -1)

int

add_source(source: TileSetSource, atlas_source_id_override: int = -1)

void

add_terrain(terrain_set: int, to_position: int = -1)

void

add_terrain_set(to_position: int = -1)

void

cleanup_invalid_tile_proxies()

void

clear_tile_proxies()

Array

get_alternative_level_tile_proxy(source_from: int, coords_from: Vector2i, alternative_from: int)

Array

get_coords_level_tile_proxy(source_from: int, coords_from: Vector2i)

int

get_custom_data_layer_by_name(layer_name: String) const

String

get_custom_data_layer_name(layer_index: int) const

Variant.Type

get_custom_data_layer_type(layer_index: int) const

int

get_custom_data_layers_count() const

bool

get_navigation_layer_layer_value(layer_index: int, layer_number: int) const

int

get_navigation_layer_layers(layer_index: int) const

int

get_navigation_layers_count() const

int

get_next_source_id() const

int

get_occlusion_layer_light_mask(layer_index: int)