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...
TileData¶
Inherits: Object
Settings for a single tile in a TileSet.
Description¶
TileData object represents a single tile in a TileSet. It is usually edited using the tileset editor, but it can be modified at runtime using TileMap._tile_data_runtime_update.
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
void |
add_collision_polygon(layer_id: int) |
get_collision_polygon_one_way_margin(layer_id: int, polygon_index: int) const |
|
get_collision_polygon_points(layer_id: int, polygon_index: int) const |
|
get_collision_polygons_count(layer_id: int) const |
|
get_constant_angular_velocity(layer_id: int) const |
|
get_constant_linear_velocity(layer_id: int) const |
|
get_custom_data(layer_name: String) const |
|
get_custom_data_by_layer_id(layer_id: int) const |
|
get_navigation_polygon(layer_id: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) const |
|
get_occluder(layer_id: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) const |
|
get_terrain_peering_bit(peering_bit: CellNeighbor) const |
|
is_collision_polygon_one_way(layer_id: int, polygon_index: int) const |
|
void |
remove_collision_polygon(layer_id: int, polygon_index: int) |
void |
set_collision_polygon_one_way(layer_id: int, polygon_index: int, one_way: bool) |
void |
set_collision_polygon_one_way_margin(layer_id: int, polygon_index: int, one_way_margin: float) |
void |
set_collision_polygon_points(layer_id: int, polygon_index: int, polygon: PackedVector2Array) |
void |
set_collision_polygons_count(layer_id: int, polygons_count: int) |
void |
set_constant_angular_velocity(layer_id: int, velocity: float) |
void |
set_constant_linear_velocity(layer_id: int, velocity: Vector2) |
void |
set_custom_data(layer_name: String, value: Variant) |
void |
set_custom_data_by_layer_id(layer_id: int, value: Variant) |
void |
set_navigation_polygon(layer_id: int, navigation_polygon: NavigationPolygon) |
void |
set_occluder(layer_id: int, occluder_polygon: OccluderPolygon2D) |
void |
set_terrain_peering_bit(peering_bit: CellNeighbor, terrain: int) |
Signals¶
changed()
Emitted when any of the properties are changed.
Property Descriptions¶
bool flip_h = false
If true
, the tile will have its texture flipped horizontally.
bool flip_v = false
If true
, the tile will have its texture flipped vertically.
Material material
The Material to use for this TileData. This can be a CanvasItemMaterial to use the default shader, or a ShaderMaterial to use a custom shader.
Color modulate = Color(1, 1, 1, 1)
Color modulation of the tile.
float probability = 1.0
Relative probability of this tile being selected when drawing a pattern of random tiles.
int terrain = -1
ID of the terrain from the terrain set that the tile uses.
int terrain_set = -1
ID of the terrain set that the tile uses.
Vector2i texture_origin = Vector2i(0, 0)
Offsets the position of where the tile is drawn.
bool transpose = false
If true
, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.
int y_sort_origin = 0
Vertical point of the tile used for determining y-sorted order.
int z_index = 0
Ordering index of this tile, relative to TileMap.
Method Descriptions¶
void add_collision_polygon(layer_id: int)
Adds a collision polygon to the tile on the given TileSet physics layer.
float get_collision_polygon_one_way_margin(layer_id: int, polygon_index: int) const
Returns the one-way margin (for one-way platforms) of the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
PackedVector2Array get_collision_polygon_points(layer_id: int, polygon_index: int) const
Returns the points of the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
int get_collision_polygons_count(layer_id: int) const
Returns how many polygons the tile has for TileSet physics layer with index layer_id
.
float get_constant_angular_velocity(layer_id: int) const
Returns the constant angular velocity applied to objects colliding with this tile.
Vector2 get_constant_linear_velocity(layer_id: int) const
Returns the constant linear velocity applied to objects colliding with this tile.
Variant get_custom_data(layer_name: String) const
Returns the custom data value for custom data layer named layer_name
.
Variant get_custom_data_by_layer_id(layer_id: int) const
Returns the custom data value for custom data layer with index layer_id
.
Returns the navigation polygon of the tile for the TileSet navigation layer with index layer_id
.
flip_h
, flip_v
, and transpose
allow transforming the returned polygon.
OccluderPolygon2D get_occluder(layer_id: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) const
Returns the occluder polygon of the tile for the TileSet occlusion layer with index layer_id
.
flip_h
, flip_v
, and transpose
allow transforming the returned polygon.
int get_terrain_peering_bit(peering_bit: CellNeighbor) const
Returns the tile's terrain bit for the given peering_bit
direction.
bool is_collision_polygon_one_way(layer_id: int, polygon_index: int) const
Returns whether one-way collisions are enabled for the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
void remove_collision_polygon(layer_id: int, polygon_index: int)
Removes the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
void set_collision_polygon_one_way(layer_id: int, polygon_index: int, one_way: bool)
Enables/disables one-way collisions on the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
void set_collision_polygon_one_way_margin(layer_id: int, polygon_index: int, one_way_margin: float)
Enables/disables one-way collisions on the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
void set_collision_polygon_points(layer_id: int, polygon_index: int, polygon: PackedVector2Array)
Sets the points of the polygon at index polygon_index
for TileSet physics layer with index layer_id
.
void set_collision_polygons_count(layer_id: int, polygons_count: int)
Sets the polygons count for TileSet physics layer with index layer_id
.
void set_constant_angular_velocity(layer_id: int, velocity: float)
Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.
void set_constant_linear_velocity(layer_id: int, velocity: Vector2)
Sets the constant linear velocity. This does not move the tile. This linear velocity is applied to objects colliding with this tile. This is useful to create conveyor belts.
void set_custom_data(layer_name: String, value: Variant)
Sets the tile's custom data value for the TileSet custom data layer with name layer_name
.
void set_custom_data_by_layer_id(layer_id: int, value: Variant)
Sets the tile's custom data value for the TileSet custom data layer with index layer_id
.
Sets the navigation polygon for the TileSet navigation layer with index layer_id
.
void set_occluder(layer_id: int, occluder_polygon: OccluderPolygon2D)
Sets the occluder for the TileSet occlusion layer with index layer_id
.
void set_terrain_peering_bit(peering_bit: CellNeighbor, terrain: int)
Sets the tile's terrain bit for the given peering_bit
direction.