TileSet¶
Inherits: Resource < Reference < Object
Tile library for tilemaps.
Description¶
A TileSet is a library of tiles for a TileMap. It contains a list of tiles, each consisting of a sprite and optional collision shapes.
Tiles are referenced by a unique integer ID.
Methods¶
Enumerations¶
- 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
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
- void autotile_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 in AutotileBindings present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
- BitmaskMode autotile_get_bitmask_mode ( int id ) const
Returns the BitmaskMode 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.
- OccluderPolygon2D autotile_get_light_occluder ( int id, Vector2 coord ) const
Returns the light occluder of the subtile from an atlas/autotile given its coordinates.
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 in AutotileBindings present in the subtile (e.g. a value of 5 means the bitmask has bindings in both the top left and top right).
- void autotile_set_bitmask_mode ( int id, BitmaskMode mode )
Sets the BitmaskMode 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.
- void autotile_set_light_occluder ( int id, OccluderPolygon2D light_occluder, Vector2 coord )
Sets the light occluder of the subtile from an atlas/autotile given its coordinates.
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.
Clears all tiles.
- void create_tile ( int id )
Creates a new tile with the given ID.
Returns the first tile matching the given name.
- int get_last_unused_tile_id ( ) const
Returns the ID following the last currently used ID, useful when creating a new tile.
- Array get_tiles_ids ( ) const
Returns an array of all currently used tile IDs.
- void remove_tile ( int id )
Removes the given tile ID.
- void tile_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.
- OccluderPolygon2D tile_get_light_occluder ( int id ) const
Returns the tile’s light occluder.
- ShaderMaterial tile_get_material ( int id ) const
Returns the tile’s material.
Returns the tile’s modulation color.
Returns the tile’s name.
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.
- Transform2D tile_get_shape_transform ( int id, int shape_id ) const
Returns the Transform2D of a tile’s shape.
Returns an array of the tile’s shapes.
Returns the tile’s texture.
Returns the texture offset of the tile.
Returns the tile’s TileMode.
Returns the tile’s Z index (drawing layer).
- void tile_set_light_occluder ( int id, OccluderPolygon2D light_occluder )
Sets a light occluder for the tile.
- void tile_set_material ( int id, ShaderMaterial material )
Sets the tile’s material.
Sets the tile’s modulation color.
Sets the tile’s name.
Sets the tile’s navigation polygon.
Sets an offset for the tile’s navigation polygon.
Sets the tile’s normal map texture.
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.
- void tile_set_shape_transform ( int id, int shape_id, Transform2D shape_transform )
Sets a Transform2D 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’s TileMode.
Sets the tile’s drawing index.