TileSetSource

继承: Resource < RefCounted < Object

派生: TileSetAtlasSource, TileSetScenesCollectionSource

Exposes a set of tiles for a TileSet resource.

描述

Exposes a set of tiles for a TileSet resource.

Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the TileSetAtlasSource class.

Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base TileSetSource class only exposes getters for them.

You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using get_tiles_count and get_tile_id, then over alternative IDs using get_alternative_tiles_count and get_alternative_tile_id.

Warning: TileSetSource can only be added to one TileSet at the same time. Calling TileSet.add_source on a second TileSet will remove the source from the first one.

方法

intget_alternative_tile_id ( atlas_coords: Vector2i, index: int ) const1
intget_alternative_tiles_count ( atlas_coords: Vector2i ) const1
Vector2iget_tile_id ( index: int ) const1
intget_tiles_count ( ) const1
boolhas_alternative_tile ( atlas_coords: Vector2i, alternative_tile: int ) const1
boolhas_tile ( atlas_coords: Vector2i ) const1

方法说明

int get_alternative_tile_id ( atlas_coords: Vector2i, index: int ) const1

Returns the alternative ID for the tile with coordinates ID atlas_coords at index index.


int get_alternative_tiles_count ( atlas_coords: Vector2i ) const1

Returns the number of alternatives tiles for the coordinates ID atlas_coords.

For TileSetAtlasSource, this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.

Returns -1 if there is not tile at the given coords.


Vector2i get_tile_id ( index: int ) const1

Returns the tile coordinates ID of the tile with index index.


int get_tiles_count ( ) const1

Returns how many tiles this atlas source defines (not including alternative tiles).


bool has_alternative_tile ( atlas_coords: Vector2i, alternative_tile: int ) const1

Returns if the base tile at coordinates atlas_coords has an alternative with ID alternative_tile.


bool has_tile ( atlas_coords: Vector2i ) const1

Returns if this atlas has a tile with coordinates ID atlas_coords.

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。