A TileSet is a library of tiles for a godot.TileMap
. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
Tiles are referenced by a unique integer ID.
Constructor
Methods
_IsTileBound(drawnId:Int, neighborId:Int):Bool
Determines when the auto-tiler should consider two different auto-tile IDs to be bound together.
Note: neighbor_id
will be -1
(godot.TileMap.invalidCell
) when checking a tile against an empty neighbor tile.
autotileGetBitmask(id:Int, coord:Vector2):UInt
Returns the bitmask of the subtile from an autotile given its coordinates.
The value is the sum of the values in godot.TileSet_AutotileBindings
present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
autotileGetBitmaskMode(id:Int):TileSet_BitmaskMode
Returns the godot.TileSet_BitmaskMode
of the autotile.
autotileGetIconCoordinate(id:Int):Vector2
Returns the subtile that's being used as an icon in an atlas/autotile given its coordinates.
The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor.
autotileGetLightOccluder(id:Int, coord:Vector2):OccluderPolygon2D
Returns the light occluder of the subtile from an atlas/autotile given its coordinates.
autotileGetNavigationPolygon(id:Int, coord:Vector2):NavigationPolygon
Returns the navigation polygon of the subtile from an atlas/autotile given its coordinates.
autotileGetSubtilePriority(id:Int, coord:Vector2):Int
Returns the priority of the subtile from an autotile given its coordinates.
When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked.
autotileGetZIndex(id:Int, coord:Vector2):Int
Returns the drawing index of the subtile from an atlas/autotile given its coordinates.
autotileSetBitmask(id:Int, bitmask:Vector2, flag:UInt):Void
Sets the bitmask of the subtile from an autotile given its coordinates.
The value is the sum of the values in godot.TileSet_AutotileBindings
present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
autotileSetBitmaskMode(id:Int, mode:TileSet_BitmaskMode):Void
Sets the godot.TileSet_BitmaskMode
of the autotile.
autotileSetIconCoordinate(id:Int, coord:Vector2):Void
Sets the subtile that will be used as an icon in an atlas/autotile given its coordinates.
The subtile defined as the icon will be used as a fallback when the atlas/autotile's bitmask information is incomplete. It will also be used to represent it in the TileSet editor.
autotileSetLightOccluder(id:Int, lightOccluder:OccluderPolygon2D, coord:Vector2):Void
Sets the light occluder of the subtile from an atlas/autotile given its coordinates.
autotileSetNavigationPolygon(id:Int, navigationPolygon:NavigationPolygon, coord:Vector2):Void
Sets the navigation polygon of the subtile from an atlas/autotile given its coordinates.
autotileSetSpacing(id:Int, spacing:Int):Void
Sets the spacing between subtiles of the atlas/autotile.
autotileSetSubtilePriority(id:Int, coord:Vector2, priority:Int):Void
Sets the priority of the subtile from an autotile given its coordinates.
When more than one subtile has the same bitmask value, one of them will be picked randomly for drawing. Its priority will define how often it will be picked.
autotileSetZIndex(id:Int, coord:Vector2, zIndex:Int):Void
Sets the drawing index of the subtile from an atlas/autotile given its coordinates.
getLastUnusedTileId():Int
Returns the ID following the last currently used ID, useful when creating a new tile.
tileAddShape(id:Int, shape:Shape2D, shapeTransform:Transform2D, ?oneWay:Bool, ?autotileCoord:Vector2):Void
Adds a shape to the tile.
Parameters:
autotileCoord | If the parameter is null, then the default value is new Vector2(0, 0) |
---|
tileGetShapeTransform(id:Int, shapeId:Int):Transform2D
Returns the godot.Transform2D
of a tile's shape.
tileGetShapes(id:Int):Array
Returns an array of dictionaries describing the tile's shapes.
Dictionary structure in the array returned by this method:
{
"autotile_coord": Vector2,
"one_way": bool,
"one_way_margin": int,
"shape": CollisionShape2D,
"shape_transform": Transform2D,
}
tileSetLightOccluder(id:Int, lightOccluder:OccluderPolygon2D):Void
Sets a light occluder for the tile.
tileSetModulate(id:Int, color:Color):Void
Sets the tile's modulation color.
Note: Modulation is performed by setting the tile's vertex color. To access this in a shader, use COLOR
rather than MODULATE
(which instead accesses the godot.TileMap
's godot.CanvasItem.modulate
property).
tileSetNavigationPolygon(id:Int, navigationPolygon:NavigationPolygon):Void
Sets the tile's navigation polygon.
tileSetNavigationPolygonOffset(id:Int, navigationPolygonOffset:Vector2):Void
Sets an offset for the tile's navigation polygon.
tileSetNormalMap(id:Int, normalMap:Texture):Void
Sets the tile's normal map texture.
Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. See [http://wiki.polycount.com/wiki/Normal_Map_Technical_Details#Common_Swizzle_Coordinates](this page) for a comparison of normal map coordinates expected by popular engines.
tileSetOccluderOffset(id:Int, occluderOffset:Vector2):Void
Sets an offset for the tile's light occluder.
tileSetRegion(id:Int, region:Rect2):Void
Sets the tile's sub-region in the texture. This is common in texture atlases.
tileSetShapeOneWay(id:Int, shapeId:Int, oneWay:Bool):Void
Enables one-way collision on a tile's shape.
tileSetShapeTransform(id:Int, shapeId:Int, shapeTransform:Transform2D):Void
Sets a godot.Transform2D
on a tile's shape.