Attention

You are reading the latest (unstable) version of this documentation, which may document features not available or compatible with Godot 3.x.

Work in progress

Godot documentation is being updated to reflect the latest changes in version 4.0. Some documentation pages may still state outdated information. This banner will tell you if you're reading one of such pages.

The contents of this page are up to date. If you can still find outdated information, please open an issue.

TileMapPattern

Inherits: Resource < RefCounted < Object

Holds a pattern to be copied from or pasted into TileMaps.

Description

This resource holds a set of cells to help bulk manipulations of TileMap.

A pattern always start at the (0,0) coordinates and cannot have cells with negative coordinates.

Methods

int

get_cell_alternative_tile ( Vector2i coords ) const

Vector2i

get_cell_atlas_coords ( Vector2i coords ) const

int

get_cell_source_id ( Vector2i coords ) const

Vector2i

get_size ( ) const

Vector2i[]

get_used_cells ( ) const

bool

has_cell ( Vector2i coords ) const

bool

is_empty ( ) const

void

remove_cell ( Vector2i coords, bool update_size )

void

set_cell ( Vector2i coords, int source_id=-1, Vector2i atlas_coords=Vector2i(-1, -1), int alternative_tile=-1 )

void

set_size ( Vector2i size )


Method Descriptions

int get_cell_alternative_tile ( Vector2i coords ) const

Returns the tile alternative ID of the cell at coords.


Vector2i get_cell_atlas_coords ( Vector2i coords ) const

Returns the tile atlas coordinates ID of the cell at coords.


int get_cell_source_id ( Vector2i coords ) const

Returns the tile source ID of the cell at coords.


Vector2i get_size ( ) const

Returns the size, in cells, of the pattern.


Vector2i[] get_used_cells ( ) const

Returns the list of used cell coordinates in the pattern.


bool has_cell ( Vector2i coords ) const

Returns whether the pattern has a tile at the given coordinates.


bool is_empty ( ) const

Returns whether the pattern is empty or not.


void remove_cell ( Vector2i coords, bool update_size )

Remove the cell at the given coordinates.


void set_cell ( Vector2i coords, int source_id=-1, Vector2i atlas_coords=Vector2i(-1, -1), int alternative_tile=-1 )

Sets the tile indentifiers for the cell at coordinates coords. See TileMap.set_cell.


void set_size ( Vector2i size )

Sets the size of the pattern.