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.

TileData

Inherits: Object

Settings for a single tile in a TileSet.

描述

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.

属性

bool

flip_h

false

bool

flip_v

false

Material

material

Color

modulate

Color(1, 1, 1, 1)

float

probability

1.0

int

terrain

-1

int

terrain_set

-1

Vector2i

texture_origin

Vector2i(0, 0)

bool

transpose

false

int

y_sort_origin

0

int

z_index

0

Methods

void

add_collision_polygon ( int layer_id )

float

get_collision_polygon_one_way_margin ( int layer_id, int polygon_index ) const

PackedVector2Array

get_collision_polygon_points ( int layer_id, int polygon_index ) const

int

get_collision_polygons_count ( int layer_id ) const

float

get_constant_angular_velocity ( int layer_id ) const

Vector2

get_constant_linear_velocity ( int layer_id ) const

Variant

get_custom_data ( String layer_name ) const

Variant

get_custom_data_by_layer_id ( int layer_id ) const

NavigationPolygon

get_navigation_polygon ( int layer_id ) const

OccluderPolygon2D

get_occluder ( int layer_id ) const

int

get_terrain_peering_bit ( CellNeighbor peering_bit ) const

bool

is_collision_polygon_one_way ( int layer_id, int polygon_index ) const

void

remove_collision_polygon ( int layer_id, int polygon_index )

void

set_collision_polygon_one_way ( int layer_id, int polygon_index, bool one_way )

void

set_collision_polygon_one_way_margin ( int layer_id, int polygon_index, float one_way_margin )

void

set_collision_polygon_points ( int layer_id, int polygon_index, PackedVector2Array polygon )

void

set_collision_polygons_count ( int layer_id, int polygons_count )

void

set_constant_angular_velocity ( int layer_id, float velocity )

void

set_constant_linear_velocity ( int layer_id, Vector2 velocity )

void

set_custom_data ( String layer_name, Variant value )

void

set_custom_data_by_layer_id ( int layer_id, Variant value )

void

set_navigation_polygon ( int layer_id, NavigationPolygon navigation_polygon )

void

set_occluder ( int layer_id, OccluderPolygon2D occluder_polygon )

void

set_terrain_peering_bit ( CellNeighbor peering_bit, int terrain )


信号

changed ( )

Emitted when any of the properties are changed.


Property Descriptions

bool flip_h = false

  • void set_flip_h ( bool value )

  • bool get_flip_h ( )

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


bool flip_v = false

  • void set_flip_v ( bool value )

  • bool get_flip_v ( )

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)

  • void set_modulate ( Color value )

  • Color get_modulate ( )

Color modulation of the tile.


float probability = 1.0

  • void set_probability ( float value )

  • float get_probability ( )

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


int terrain = -1

  • void set_terrain ( int value )

  • int get_terrain ( )

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


int terrain_set = -1

  • void set_terrain_set ( int value )

  • int get_terrain_set ( )

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

  • void set_transpose ( bool value )

  • bool get_transpose ( )

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


int y_sort_origin = 0

  • void set_y_sort_origin ( int value )

  • int get_y_sort_origin ( )

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


int z_index = 0

  • void set_z_index ( int value )

  • int get_z_index ( )

Ordering index of this tile, relative to TileMap.


Method Descriptions

void add_collision_polygon ( int layer_id )

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


float get_collision_polygon_one_way_margin ( int layer_id,