class_tileset - vkbsb/godot GitHub Wiki

TileSet

####Inherits: Resource ####Category: Core

Brief Description

Tile library for tilemaps.

Member Functions

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.

Member Function Description

create_tile

  • void create_tile ( int id )

Create a new tile, the ID must be specified.

tile_set_name

Set the name of a tile, for decriptive purposes.

tile_get_name

Return the name of a tile, for decriptive purposes.

tile_set_texture

  • void tile_set_texture ( int id, Texture texture )

Set the texture of the tile.

tile_get_texture

Return the texture of the tile.

tile_set_region

  • void tile_set_region ( int id, Rect2 region )

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

tile_get_region

  • Rect2 tile_get_region ( int id ) const

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

tile_set_shape

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

tile_get_shape

Return the shape of the tile.

remove_tile

  • void remove_tile ( int id )

Remove a tile, by integer id.

clear

  • void clear ( )

Clear all tiles.

get_last_unused_tile_id

  • int get_last_unused_tile_id ( ) const

Find an empty id for creating a new tile.

find_tile_by_name

  • int find_tile_by_name ( String name ) const

Find the first tile with the given name.