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.
Checking the stable version of the documentation...
TileMapPattern¶
继承: Resource < RefCounted < Object
存放 TileMap 的图案,用于复制粘贴。
描述¶
这个资源存放的是一组单元格,能够帮助进行 TileMap 的批量操作。
图案始终从 (0,0)
坐标开始,不能存在负数坐标的单元格。
方法¶
get_cell_alternative_tile ( Vector2i coords ) const |
|
get_cell_atlas_coords ( Vector2i coords ) const |
|
get_cell_source_id ( Vector2i coords ) const |
|
get_size ( ) const |
|
get_used_cells ( ) const |
|
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 |
方法说明¶
int get_cell_alternative_tile ( Vector2i coords ) const
返回位于 coords
的单元格的备选图块 ID。
Vector2i get_cell_atlas_coords ( Vector2i coords ) const
返回位于 coords
的单元格的图块图集坐标 ID。
int get_cell_source_id ( Vector2i coords ) const
返回位于 coords
的单元格的图块源 ID。
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 )
设置位于 coords
的单元格的图块标识符。见 TileMap.set_cell。
void set_size ( Vector2i size )
设置图案的大小。