TileData
Settings for a single tile in a TileSet
.
class TileData
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(layer:coords:tileData:)
.
This object emits the following signals:
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
var changed: SimpleSignal
Emitted when any of the properties are changed.
var flipH: Bool
If
true
, the tile will have its texture flipped horizontally.var flipV: Bool
If
true
, the tile will have its texture flipped vertically.var material: Material?
The
Material
to use for thisTileData
. This can be aCanvasItemMaterial
to use the default shader, or aShaderMaterial
to use a custom shader.var modulate: Color
Color modulation of the tile.
var probability: Double
Relative probability of this tile being selected when drawing a pattern of random tiles.
var terrain: Int32
ID of the terrain from the terrain set that the tile uses.
var terrainSet: Int32
ID of the terrain set that the tile uses.
var textureOrigin: Vector2i
Offsets the position of where the tile is drawn.
var transpose: Bool
If
true
, the tile will display transposed, i.e. with horizontal and vertical texture UVs swapped.var ySortOrigin: Int32
Vertical point of the tile used for determining y-sorted order.
var zIndex: Int32
Ordering index of this tile, relative to
TileMap
.func addCollisionPolygon(layerId: Int32
) Adds a collision polygon to the tile on the given TileSet physics layer.
func getCollisionPolygonOneWayMargin(layerId: Int32, polygonIndex: Int32
) -> Double Returns the one-way margin (for one-way platforms) of the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func getCollisionPolygonPoints(layerId: Int32, polygonIndex: Int32
) -> PackedVector2Array Returns the points of the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func getCollisionPolygonsCount(layerId: Int32
) -> Int32 Returns how many polygons the tile has for TileSet physics layer with index
layerId
.func getConstantAngularVelocity(layerId: Int32
) -> Double Returns the constant angular velocity applied to objects colliding with this tile.
func getConstantLinearVelocity(layerId: Int32
) -> Vector2 Returns the constant linear velocity applied to objects colliding with this tile.
func getCustomData(layerName: String
) -> Variant Returns the custom data value for custom data layer named
layerName
.func getCustomDataByLayerId(Int32
) -> Variant Returns the custom data value for custom data layer with index
layerId
.func getOccluder(layerId: Int32
) -> OccluderPolygon2D? Returns the occluder polygon of the tile for the TileSet occlusion layer with index
layerId
.func getTerrainPeeringBit(TileSet.CellNeighbor
) -> Int32 Returns the tile’s terrain bit for the given
peeringBit
direction.func isCollisionPolygonOneWay(layerId: Int32, polygonIndex: Int32
) -> Bool Returns whether one-way collisions are enabled for the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func removeCollisionPolygon(layerId: Int32, polygonIndex: Int32
) Removes the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func setCollisionPolygonOneWay(layerId: Int32, polygonIndex: Int32, oneWay: Bool
) Enables/disables one-way collisions on the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func setCollisionPolygonOneWayMargin(layerId: Int32, polygonIndex: Int32, oneWayMargin: Double
) Enables/disables one-way collisions on the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func setCollisionPolygonPoints(layerId: Int32, polygonIndex: Int32, polygon: PackedVector2Array
) Sets the points of the polygon at index
polygonIndex
for TileSet physics layer with indexlayerId
.func setCollisionPolygonsCount(layerId: Int32, polygonsCount: Int32
) Sets the polygons count for TileSet physics layer with index
layerId
.func setConstantAngularVelocity(layerId: Int32, velocity: Double
) Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile.
func setConstantLinearVelocity(layerId: Int32, 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.
func setCustomData(layerName: String, value: Variant
) Sets the tile’s custom data value for the TileSet custom data layer with name
layerName
.func setCustomDataByLayerId(Int32, value: Variant
) Sets the tile’s custom data value for the TileSet custom data layer with index
layerId
.func setOccluder(layerId: Int32, occluderPolygon: OccluderPolygon2D?
) Sets the occluder for the TileSet occlusion layer with index
layerId
.func setTerrainPeeringBit(TileSet.CellNeighbor, terrain: Int32
) Sets the tile’s terrain bit for the given
peeringBit
direction.