TileData
Inherits:Object
Settings for a single tile in aTileSet.
Description
TileData object represents a single tile in aTileSet. It is usually edited using the tileset editor, but it can be modified at runtime usingTileMap._tile_data_runtime_update().
Properties
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
Methods
Signals
changed()🔗
Emitted when any of the properties are changed.
Property Descriptions
boolget_flip_h()
Iftrue
, the tile will have its texture flipped horizontally.
boolget_flip_v()
Iftrue
, the tile will have its texture flipped vertically.
Materialget_material()
TheMaterial to use for thisTileData. This can be aCanvasItemMaterial to use the default shader, or aShaderMaterial to use a custom shader.
Colormodulate =Color(1,1,1,1)
🔗
Colorget_modulate()
Color modulation of the tile.
floatget_probability()
Relative probability of this tile being selected when drawing a pattern of random tiles.
intget_terrain()
ID of the terrain from the terrain set that the tile uses.
intget_terrain_set()
ID of the terrain set that the tile uses.
Vector2itexture_origin =Vector2i(0,0)
🔗
Vector2iget_texture_origin()
Offsets the position of where the tile is drawn.
boolget_transpose()
Iftrue
, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.
intget_y_sort_origin()
Vertical point of the tile used for determining y-sorted order.
intget_z_index()
Ordering index of this tile, relative toTileMap.
Method Descriptions
voidadd_collision_polygon(layer_id:int)🔗
Adds a collision polygon to the tile on the given TileSet physics layer.
voidadd_occluder_polygon(layer_id:int)🔗
Adds an occlusion polygon to the tile on the TileSet occlusion layer with indexlayer_id
.
floatget_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 indexpolygon_index
for TileSet physics layer with indexlayer_id
.
PackedVector2Arrayget_collision_polygon_points(layer_id:int, polygon_index:int)const🔗
Returns the points of the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
intget_collision_polygons_count(layer_id:int)const🔗
Returns how many polygons the tile has for TileSet physics layer with indexlayer_id
.
floatget_constant_angular_velocity(layer_id:int)const🔗
Returns the constant angular velocity applied to objects colliding with this tile.
Vector2get_constant_linear_velocity(layer_id:int)const🔗
Returns the constant linear velocity applied to objects colliding with this tile.
Variantget_custom_data(layer_name:String)const🔗
Returns the custom data value for custom data layer namedlayer_name
. To check if a custom data layer exists, usehas_custom_data().
Variantget_custom_data_by_layer_id(layer_id:int)const🔗
Returns the custom data value for custom data layer with indexlayer_id
.
NavigationPolygonget_navigation_polygon(layer_id:int, flip_h:bool = false, flip_v:bool = false, transpose:bool = false)const🔗
Returns the navigation polygon of the tile for the TileSet navigation layer with indexlayer_id
.
flip_h
,flip_v
, andtranspose
allow transforming the returned polygon.
OccluderPolygon2Dget_occluder(layer_id:int, flip_h:bool = false, flip_v:bool = false, transpose:bool = false)const🔗
Deprecated: Useget_occluder_polygon() instead.
Returns the occluder polygon of the tile for the TileSet occlusion layer with indexlayer_id
.
flip_h
,flip_v
, andtranspose
allow transforming the returned polygon.
OccluderPolygon2Dget_occluder_polygon(layer_id:int, polygon_index:int, flip_h:bool = false, flip_v:bool = false, transpose:bool = false)const🔗
Returns the occluder polygon at indexpolygon_index
from the TileSet occlusion layer with indexlayer_id
.
Theflip_h
,flip_v
, andtranspose
parameters can betrue
to transform the returned polygon.
intget_occluder_polygons_count(layer_id:int)const🔗
Returns the number of occluder polygons of the tile in the TileSet occlusion layer with indexlayer_id
.
intget_terrain_peering_bit(peering_bit:CellNeighbor)const🔗
Returns the tile's terrain bit for the givenpeering_bit
direction. To check that a direction is valid, useis_valid_terrain_peering_bit().
boolhas_custom_data(layer_name:String)const🔗
Returns whether there exists a custom data layer namedlayer_name
.
boolis_collision_polygon_one_way(layer_id:int, polygon_index:int)const🔗
Returns whether one-way collisions are enabled for the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
boolis_valid_terrain_peering_bit(peering_bit:CellNeighbor)const🔗
Returns whether the givenpeering_bit
direction is valid for this tile.
voidremove_collision_polygon(layer_id:int, polygon_index:int)🔗
Removes the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
voidremove_occluder_polygon(layer_id:int, polygon_index:int)🔗
Removes the polygon at indexpolygon_index
for TileSet occlusion layer with indexlayer_id
.
voidset_collision_polygon_one_way(layer_id:int, polygon_index:int, one_way:bool)🔗
Enables/disables one-way collisions on the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
voidset_collision_polygon_one_way_margin(layer_id:int, polygon_index:int, one_way_margin:float)🔗
Sets the one-way margin (for one-way platforms) of the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
voidset_collision_polygon_points(layer_id:int, polygon_index:int, polygon:PackedVector2Array)🔗
Sets the points of the polygon at indexpolygon_index
for TileSet physics layer with indexlayer_id
.
voidset_collision_polygons_count(layer_id:int, polygons_count:int)🔗
Sets the polygons count for TileSet physics layer with indexlayer_id
.
voidset_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.
voidset_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.
voidset_custom_data(layer_name:String, value:Variant)🔗
Sets the tile's custom data value for the TileSet custom data layer with namelayer_name
.
voidset_custom_data_by_layer_id(layer_id:int, value:Variant)🔗
Sets the tile's custom data value for the TileSet custom data layer with indexlayer_id
.
voidset_navigation_polygon(layer_id:int, navigation_polygon:NavigationPolygon)🔗
Sets the navigation polygon for the TileSet navigation layer with indexlayer_id
.
voidset_occluder(layer_id:int, occluder_polygon:OccluderPolygon2D)🔗
Deprecated: Useset_occluder_polygon() instead.
Sets the occluder for the TileSet occlusion layer with indexlayer_id
.
voidset_occluder_polygon(layer_id:int, polygon_index:int, polygon:OccluderPolygon2D)🔗
Sets the occluder for polygon with indexpolygon_index
in the TileSet occlusion layer with indexlayer_id
.
voidset_occluder_polygons_count(layer_id:int, polygons_count:int)🔗
Sets the occluder polygon count in the TileSet occlusion layer with indexlayer_id
.
voidset_terrain_peering_bit(peering_bit:CellNeighbor, terrain:int)🔗
Sets the tile's terrain bit for the givenpeering_bit
direction. To check that a direction is valid, useis_valid_terrain_peering_bit().