TileSet

Inherits: Resource < Reference < Object

Category: Core

Brief Description

Tile library for tilemaps.

Member Functions

void clear ( )
void create_tile ( int id )
int find_tile_by_name ( String name ) const
int get_last_unused_tile_id ( ) const
Array get_tiles_ids ( ) const
void remove_tile ( int id )
OccluderPolygon2D tile_get_light_occluder ( int id ) const
CanvasItemMaterial tile_get_material ( int id ) const
String tile_get_name ( int id ) const
NavigationPolygon tile_get_navigation_polygon ( int id ) const
Vector2 tile_get_navigation_polygon_offset ( int id ) const
Vector2 tile_get_occluder_offset ( int id ) const
Rect2 tile_get_region ( int id ) const
Shape2D tile_get_shape ( int id ) const
Vector2 tile_get_shape_offset ( int id ) const
Array tile_get_shapes ( int id ) const
Texture tile_get_texture ( int id ) const
Vector2 tile_get_texture_offset ( int id ) const
void tile_set_light_occluder ( int id, OccluderPolygon2D light_occluder )
void tile_set_material ( int id, CanvasItemMaterial material )
void tile_set_name ( int id, String name )
void tile_set_navigation_polygon ( int id, NavigationPolygon navigation_polygon )
void tile_set_navigation_polygon_offset ( int id, Vector2 navigation_polygon_offset )
void tile_set_occluder_offset ( int id, Vector2 occluder_offset )
void tile_set_region ( int id, Rect2 region )
void tile_set_shape ( int id, Shape2D shape )
void tile_set_shape_offset ( int id, Vector2 shape_offset )
void tile_set_shapes ( int id, Array shapes )
void tile_set_texture ( int id, Texture texture )
void tile_set_texture_offset ( int id, Vector2 texture_offset )

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.

Member Function Description

  • void clear ( )

Clear all tiles.

  • void create_tile ( int id )

Create a new tile which will be referenced by the given ID.

  • int find_tile_by_name ( String name ) const

Find the first tile matching the given name.

  • int get_last_unused_tile_id ( ) const

Return the ID following the last currently used ID, useful when creating a new tile.

  • Array get_tiles_ids ( ) const

Return an array of all currently used tile IDs.

  • void remove_tile ( int id )

Remove the tile referenced by the given ID.

Return the light occluder of the tile.

Return the material of the tile.

Return the name of the tile.

Return the navigation polygon of the tile.

  • Vector2 tile_get_navigation_polygon_offset ( int id ) const

Return the offset of the tile’s navigation polygon.

  • Vector2 tile_get_occluder_offset ( int id ) const

Return the offset of the tile’s light occluder.

  • Rect2 tile_get_region ( int id ) const

Return the tile sub-region in the texture.

Return the shape of the tile.

Return the shape offset of the tile.

  • Array tile_get_shapes ( int id ) const

Return the array of shapes of the tile.

Return the texture of the tile.

  • Vector2 tile_get_texture_offset ( int id ) const

Return the texture offset of the tile.

Set a light occluder for the tile.

Set the material of the tile.

Set the name of the tile, for descriptive purposes.

Set a navigation polygon for the tile.

  • void tile_set_navigation_polygon_offset ( int id, Vector2 navigation_polygon_offset )

Set an offset for the tile’s navigation polygon.

  • void tile_set_occluder_offset ( int id, Vector2 occluder_offset )

Set an offset for the tile’s light occluder.

  • void tile_set_region ( int id, Rect2 region )

Set the tile sub-region in the texture. This is common in texture atlases.

Set a shape for the tile, enabling physics to collide with it.

  • void tile_set_shape_offset ( int id, Vector2 shape_offset )

Set the shape offset of the tile.

  • void tile_set_shapes ( int id, Array shapes )

Set an array of shapes for the tile, enabling physics to collide with it.

  • void tile_set_texture ( int id, Texture texture )

Set the texture of the tile.

  • void tile_set_texture_offset ( int id, Vector2 texture_offset )

Set the texture offset of the tile.