TileSet¶
Inherits:Resource<Reference<Object
Tile library for tilemaps.
Description¶
A TileSet is a library of tiles for aTileMap. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
Tiles are referenced by a unique integer ID.
Tutorials¶
Methods¶
Enumerations¶
enumBitmaskMode:
BITMASK_2X2 =0
BITMASK_3X3_MINIMAL =1
BITMASK_3X3 =2
enumAutotileBindings:
BIND_TOPLEFT =1
BIND_TOP =2
BIND_TOPRIGHT =4
BIND_LEFT =8
BIND_CENTER =16
BIND_RIGHT =32
BIND_BOTTOMLEFT =64
BIND_BOTTOM =128
BIND_BOTTOMRIGHT =256
enumTileMode:
SINGLE_TILE =0
AUTO_TILE =1
ATLAS_TILE =2
Method Descriptions¶
Vector2_forward_atlas_subtile_selection(int atlastile_id,Object tilemap,Vector2 tile_location)virtual
Vector2_forward_subtile_selection(int autotile_id,int bitmask,Object tilemap,Vector2 tile_location)virtual
Determines when the auto-tiler should consider two different auto-tile IDs to be bound together.
Note:neighbor_id will be-1 (TileMap.INVALID_CELL) when checking a tile against an empty neighbor tile.
voidautotile_clear_bitmask_map(int id)
Clears all bitmask information of the autotile.
Returns the bitmask of the subtile from an autotile given its coordinates.
The value is the sum of the values inAutotileBindings present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
BitmaskModeautotile_get_bitmask_mode(int id)const
Returns theBitmaskMode of the autotile.
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.
OccluderPolygon2Dautotile_get_light_occluder(int id,Vector2 coord)const
Returns the light occluder of the subtile from an atlas/autotile given its coordinates.
NavigationPolygonautotile_get_navigation_polygon(int id,Vector2 coord)const
Returns the navigation polygon of the subtile from an atlas/autotile given its coordinates.
Returns the size of the subtiles in an atlas/autotile.
Returns the spacing between subtiles of the atlas/autotile.
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.
Returns the drawing index of the subtile from an atlas/autotile given its coordinates.
Sets the bitmask of the subtile from an autotile given its coordinates.
The value is the sum of the values inAutotileBindings present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
voidautotile_set_bitmask_mode(int id,BitmaskMode mode)
Sets theBitmaskMode of the autotile.
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.
voidautotile_set_light_occluder(int id,OccluderPolygon2D light_occluder,Vector2 coord)
Sets the light occluder of the subtile from an atlas/autotile given its coordinates.
voidautotile_set_navigation_polygon(int id,NavigationPolygon navigation_polygon,Vector2 coord)
Sets the navigation polygon of the subtile from an atlas/autotile given its coordinates.
Sets the size of the subtiles in an atlas/autotile.
Sets the spacing between subtiles of the atlas/autotile.
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.
Sets the drawing index of the subtile from an atlas/autotile given its coordinates.
voidclear()
Clears all tiles.
voidcreate_tile(int id)
Creates a new tile with the given ID.
Returns the first tile matching the given name.
Returns the ID following the last currently used ID, useful when creating a new tile.
Returns an array of all currently used tile IDs.
voidremove_tile(int id)
Removes the given tile ID.
voidtile_add_shape(int id,Shape2D shape,Transform2D shape_transform,bool one_way=false,Vector2 autotile_coord=Vector2( 0, 0 ))
Adds a shape to the tile.
OccluderPolygon2Dtile_get_light_occluder(int id)const
Returns the tile's light occluder.
ShaderMaterialtile_get_material(int id)const
Returns the tile's material.
Returns the tile's modulation color.
Returns the tile's name.
NavigationPolygontile_get_navigation_polygon(int id)const
Returns the navigation polygon of the tile.
Returns the offset of the tile's navigation polygon.
Returns the tile's normal map texture.
Returns the offset of the tile's light occluder.
Returns the tile sub-region in the texture.
Returns a tile's given shape.
Returns the number of shapes assigned to a tile.
Returns the offset of a tile's shape.
Returns the one-way collision value of a tile's shape.
Transform2Dtile_get_shape_transform(int id,int shape_id)const
Returns theTransform2D of a tile's shape.
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,}
Returns the tile's texture.
Returns the texture offset of the tile.
Returns the tile'sTileMode.
Returns the tile's Z index (drawing layer).
voidtile_set_light_occluder(int id,OccluderPolygon2D light_occluder)
Sets a light occluder for the tile.
voidtile_set_material(int id,ShaderMaterial material)
Sets the tile's material.
Sets the tile's modulation color.
Note: Modulation is performed by setting the tile's vertex color. To access this in a shader, useCOLOR rather thanMODULATE (which instead accesses theTileMap'sCanvasItem.modulate property).
Sets the tile's name.
voidtile_set_navigation_polygon(int id,NavigationPolygon navigation_polygon)
Sets the tile's navigation polygon.
Sets an offset for the tile's navigation polygon.
Sets the tile's normal map texture.
Note: Godot expects the normal map to use X+, Y-, and Z+ coordinates. Seethis page for a comparison of normal map coordinates expected by popular engines.
Sets an offset for the tile's light occluder.
Sets the tile's sub-region in the texture. This is common in texture atlases.
Sets a shape for the tile, enabling collision.
Sets the offset of a tile's shape.
Enables one-way collision on a tile's shape.
voidtile_set_shape_transform(int id,int shape_id,Transform2D shape_transform)
Sets aTransform2D on a tile's shape.
Sets an array of shapes for the tile, enabling collision.
Sets the tile's texture.
Sets the tile's texture offset.
Sets the tile'sTileMode.
Sets the tile's drawing index.