Index · Object → TileData

TileData

Settings for a single tile in a TileSet.

Class 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 TileMapLayer._tile_data_runtime_update().

Properties

var flip_h: bool = false

If true, the tile will have its texture flipped horizontally.

var flip_v: bool = false

If true, the tile will have its texture flipped vertically.

var 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.

var modulate: Color = Color(1, 1, 1, 1)

Color modulation of the tile.

var probability: float = 1.0

Relative probability of this tile being selected when drawing a pattern of random tiles.

var terrain: int = -1

ID of the terrain from the terrain set that the tile uses.

var terrain_set: int = -1

ID of the terrain set that the tile uses.

var texture_origin: Vector2i = Vector2i(0, 0)

Offsets the position of where the tile is drawn.

var transpose: bool = false

If true, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.

var y_sort_origin: int = 0

Vertical point of the tile used for determining y-sorted order.

var z_index: int = 0

Ordering index of this tile, relative to TileMapLayer.

Methods

func add_collision_polygon(layer_id: int) -> void

Adds a collision polygon to the tile on the given TileSet physics layer.

func add_occluder_polygon(layer_id: int) -> void

Adds an occlusion polygon to the tile on the TileSet occlusion layer with index layer_id.

func get_collision_polygon_one_way_margin(layer_id: int, polygon_index: int) -> float

Returns the one-way margin (for one-way platforms) of the polygon at index polygon_index for TileSet physics layer with index layer_id.

func get_collision_polygon_points(layer_id: int, polygon_index: int) -> PackedVector2Array

Returns the points of the polygon at index polygon_index for TileSet physics layer with index layer_id.

func get_collision_polygons_count(layer_id: int) -> int

Returns how many polygons the tile has for TileSet physics layer with index layer_id.

func get_constant_angular_velocity(layer_id: int) -> float

Returns the constant angular velocity applied to objects colliding with this tile.

func get_constant_linear_velocity(layer_id: int) -> Vector2

Returns the constant linear velocity applied to objects colliding with this tile.

func get_custom_data(layer_name: String) -> Variant

Returns the custom data value for custom data layer named layer_name. To check if a custom data layer exists, use has_custom_data().

func get_custom_data_by_layer_id(layer_id: int) -> Variant

Returns the custom data value for custom data layer with index layer_id.

func get_navigation_polygon(layer_id: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) -> NavigationPolygon

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.

func get_occluder(layer_id: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) -> OccluderPolygon2D

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.

func get_occluder_polygon(layer_id: int, polygon_index: int, flip_h: bool = false, flip_v: bool = false, transpose: bool = false) -> OccluderPolygon2D

Returns the occluder polygon at index polygon_index from the TileSet occlusion layer with index layer_id.

The flip_h, flip_v, and transpose parameters can be true to transform the returned polygon.

func get_occluder_polygons_count(layer_id: int) -> int

Returns the number of occluder polygons of the tile in the TileSet occlusion layer with index layer_id.

func get_terrain_peering_bit(peering_bit: TileSet.CellNeighbor) -> int

Returns the tile's terrain bit for the given peering_bit direction. To check that a direction is valid, use is_valid_terrain_peering_bit().

func has_custom_data(layer_name: String) -> bool

Returns whether there exists a custom data layer named layer_name.

func is_collision_polygon_one_way(layer_id: int, polygon_index: int) -> bool

Returns whether one-way collisions are enabled for the polygon at index polygon_index for TileSet physics layer with index layer_id.

func is_valid_terrain_peering_bit(peering_bit: TileSet.CellNeighbor) -> bool

Returns whether the given peering_bit direction is valid for this tile.

func remove_collision_polygon(layer_id: int, polygon_index: int) -> void

Removes the polygon at index polygon_index for TileSet physics layer with index layer_id.

func remove_occluder_polygon(layer_id: int, polygon_index: int) -> void

Removes the polygon at index polygon_index for TileSet occlusion layer with index layer_id.

func set_collision_polygon_one_way(layer_id: int, polygon_index: int, one_way: bool) -> void

Enables/disables one-way collisions on the polygon at index polygon_index for TileSet physics layer with index layer_id.

func set_collision_polygon_one_way_margin(layer_id: int, polygon_index: int, one_way_margin: float) -> void

Sets the one-way margin (for one-way platforms) of the polygon at index polygon_index for TileSet physics layer with index layer_id.

func set_collision_polygon_points(layer_id: int, polygon_index: int, polygon: PackedVector2Array) -> void

Sets the points of the polygon at index polygon_index for TileSet physics layer with index layer_id.

func set_collision_polygons_count(layer_id: int, polygons_count: int) -> void

Sets the polygons count for TileSet physics layer with index layer_id.

func set_constant_angular_velocity(layer_id: int, velocity: float) -> void

Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.

func set_constant_linear_velocity(layer_id: int, velocity: Vector2) -> void

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.

func set_custom_data(layer_name: String, value: Variant) -> void

Sets the tile's custom data value for the TileSet custom data layer with name layer_name.

func set_custom_data_by_layer_id(layer_id: int, value: Variant) -> void

Sets the tile's custom data value for the TileSet custom data layer with index layer_id.

func set_navigation_polygon(layer_id: int, navigation_polygon: NavigationPolygon) -> void

Sets the navigation polygon for the TileSet navigation layer with index layer_id.

func set_occluder(layer_id: int, occluder_polygon: OccluderPolygon2D) -> void

Sets the occluder for the TileSet occlusion layer with index layer_id.

func set_occluder_polygon(layer_id: int, polygon_index: int, polygon: OccluderPolygon2D) -> void

Sets the occluder for polygon with index polygon_index in the TileSet occlusion layer with index layer_id.

func set_occluder_polygons_count(layer_id: int, polygons_count: int) -> void

Sets the occluder polygon count in the TileSet occlusion layer with index layer_id.

func set_terrain_peering_bit(peering_bit: TileSet.CellNeighbor, terrain: int) -> void

Sets the tile's terrain bit for the given peering_bit direction. To check that a direction is valid, use is_valid_terrain_peering_bit().

Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal changed()

Emitted when any of the properties are changed.

Inherited from Object (2)