Class TileData
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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 _TileDataRuntimeUpdate(int, Vector2I, TileData).
public class TileData : GodotObject, IDisposable
- Inheritance
-
TileData
- Implements
- Inherited Members
Constructors
TileData()
public TileData()
Properties
FlipH
If true
, the tile will have its texture flipped horizontally.
public bool FlipH { get; set; }
Property Value
FlipV
If true
, the tile will have its texture flipped vertically.
public bool FlipV { get; set; }
Property Value
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.
public Material Material { get; set; }
Property Value
Modulate
Color modulation of the tile.
public Color Modulate { get; set; }
Property Value
Probability
Relative probability of this tile being selected when drawing a pattern of random tiles.
public float Probability { get; set; }
Property Value
Terrain
ID of the terrain from the terrain set that the tile uses.
public int Terrain { get; set; }
Property Value
TerrainSet
ID of the terrain set that the tile uses.
public int TerrainSet { get; set; }
Property Value
TextureOrigin
Offsets the position of where the tile is drawn.
public Vector2I TextureOrigin { get; set; }
Property Value
Transpose
If true
, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.
public bool Transpose { get; set; }
Property Value
YSortOrigin
Vertical point of the tile used for determining y-sorted order.
public int YSortOrigin { get; set; }
Property Value
ZIndex
Ordering index of this tile, relative to TileMap.
public int ZIndex { get; set; }
Property Value
Methods
AddCollisionPolygon(int)
Adds a collision polygon to the tile on the given TileSet physics layer.
public void AddCollisionPolygon(int layerId)
Parameters
layerId
int
GetCollisionPolygonOneWayMargin(int, int)
Returns the one-way margin (for one-way platforms) of the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public float GetCollisionPolygonOneWayMargin(int layerId, int polygonIndex)
Parameters
Returns
GetCollisionPolygonPoints(int, int)
Returns the points of the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public Vector2[] GetCollisionPolygonPoints(int layerId, int polygonIndex)
Parameters
Returns
- Vector2[]
GetCollisionPolygonsCount(int)
Returns how many polygons the tile has for TileSet physics layer with index layerId
.
public int GetCollisionPolygonsCount(int layerId)
Parameters
layerId
int
Returns
GetConstantAngularVelocity(int)
Returns the constant angular velocity applied to objects colliding with this tile.
public float GetConstantAngularVelocity(int layerId)
Parameters
layerId
int
Returns
GetConstantLinearVelocity(int)
Returns the constant linear velocity applied to objects colliding with this tile.
public Vector2 GetConstantLinearVelocity(int layerId)
Parameters
layerId
int
Returns
GetCustomData(string)
Returns the custom data value for custom data layer named layerName
.
public Variant GetCustomData(string layerName)
Parameters
layerName
string
Returns
GetCustomDataByLayerId(int)
Returns the custom data value for custom data layer with index layerId
.
public Variant GetCustomDataByLayerId(int layerId)
Parameters
layerId
int
Returns
GetNavigationPolygon(int)
Returns the navigation polygon of the tile for the TileSet navigation layer with index layerId
.
public NavigationPolygon GetNavigationPolygon(int layerId)
Parameters
layerId
int
Returns
GetOccluder(int)
Returns the occluder polygon of the tile for the TileSet occlusion layer with index layerId
.
public OccluderPolygon2D GetOccluder(int layerId)
Parameters
layerId
int
Returns
GetTerrainPeeringBit(CellNeighbor)
Returns the tile's terrain bit for the given peeringBit
direction.
public int GetTerrainPeeringBit(TileSet.CellNeighbor peeringBit)
Parameters
peeringBit
TileSet.CellNeighbor
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsCollisionPolygonOneWay(int, int)
Returns whether one-way collisions are enabled for the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public bool IsCollisionPolygonOneWay(int layerId, int polygonIndex)
Parameters
Returns
RemoveCollisionPolygon(int, int)
Removes the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public void RemoveCollisionPolygon(int layerId, int polygonIndex)
Parameters
SetCollisionPolygonOneWay(int, int, bool)
Enables/disables one-way collisions on the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public void SetCollisionPolygonOneWay(int layerId, int polygonIndex, bool oneWay)
Parameters
SetCollisionPolygonOneWayMargin(int, int, float)
Enables/disables one-way collisions on the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public void SetCollisionPolygonOneWayMargin(int layerId, int polygonIndex, float oneWayMargin)
Parameters
SetCollisionPolygonPoints(int, int, Vector2[])
Sets the points of the polygon at index polygonIndex
for TileSet physics layer with index layerId
.
public void SetCollisionPolygonPoints(int layerId, int polygonIndex, Vector2[] polygon)
Parameters
SetCollisionPolygonsCount(int, int)
Sets the polygons count for TileSet physics layer with index layerId
.
public void SetCollisionPolygonsCount(int layerId, int polygonsCount)
Parameters
SetConstantAngularVelocity(int, float)
Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.
public void SetConstantAngularVelocity(int layerId, float velocity)
Parameters
SetConstantLinearVelocity(int, 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.
public void SetConstantLinearVelocity(int layerId, Vector2 velocity)
Parameters
SetCustomData(string, Variant)
Sets the tile's custom data value for the TileSet custom data layer with name layerName
.
public void SetCustomData(string layerName, Variant value)
Parameters
SetCustomDataByLayerId(int, Variant)
Sets the tile's custom data value for the TileSet custom data layer with index layerId
.
public void SetCustomDataByLayerId(int layerId, Variant value)
Parameters
SetNavigationPolygon(int, NavigationPolygon)
Sets the navigation polygon for the TileSet navigation layer with index layerId
.
public void SetNavigationPolygon(int layerId, NavigationPolygon navigationPolygon)
Parameters
layerId
intnavigationPolygon
NavigationPolygon
SetOccluder(int, OccluderPolygon2D)
Sets the occluder for the TileSet occlusion layer with index layerId
.
public void SetOccluder(int layerId, OccluderPolygon2D occluderPolygon)
Parameters
layerId
intoccluderPolygon
OccluderPolygon2D
SetTerrainPeeringBit(CellNeighbor, int)
Sets the tile's terrain bit for the given peeringBit
direction.
public void SetTerrainPeeringBit(TileSet.CellNeighbor peeringBit, int terrain)
Parameters
peeringBit
TileSet.CellNeighborterrain
int
Events
Changed
Emitted when any of the properties are changed.
public event Action Changed