TileSet

Inherits: Resource < Reference < Object

Category: Core

Brief Description

Tile library for tilemaps.

Methods

Vector2 _forward_subtile_selection ( int autotile_id, int bitmask, Object tilemap, Vector2 tile_location ) virtual
bool _is_tile_bound ( int drawn_id, int neighbor_id ) virtual
BitmaskMode autotile_get_bitmask_mode ( int id ) const
Vector2 autotile_get_size ( int id ) const
void autotile_set_bitmask_mode ( int id, BitmaskMode mode )
void autotile_set_size ( int id, Vector2 size )
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 )
void tile_add_shape ( int id, Shape2D shape, Transform2D shape_transform, bool one_way=false, Vector2 autotile_coord=Vector2( 0, 0 ) )
OccluderPolygon2D tile_get_light_occluder ( int id ) const
ShaderMaterial tile_get_material ( int id ) const
Color tile_get_modulate ( 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
Texture tile_get_normal_map ( int id ) const
Vector2 tile_get_occluder_offset ( int id ) const
Rect2 tile_get_region ( int id ) const
Shape2D tile_get_shape ( int id, int shape_id ) const
int tile_get_shape_count ( int id ) const
Vector2 tile_get_shape_offset ( int id, int shape_id ) const
bool tile_get_shape_one_way ( int id, int shape_id ) const
Transform2D tile_get_shape_transform ( int id, int shape_id ) const
Array tile_get_shapes ( int id ) const
Texture tile_get_texture ( int id ) const
Vector2 tile_get_texture_offset ( int id ) const
TileMode tile_get_tile_mode ( int id ) const
int tile_get_z_index ( int id ) const
void tile_set_light_occluder ( int id, OccluderPolygon2D light_occluder )
void tile_set_material ( int id, ShaderMaterial material )
void tile_set_modulate ( int id, Color color )
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_normal_map ( int id, Texture normal_map )
void tile_set_occluder_offset ( int id, Vector2 occluder_offset )
void tile_set_region ( int id, Rect2 region )
void tile_set_shape ( int id, int shape_id, Shape2D shape )
void tile_set_shape_offset ( int id, int shape_id, Vector2 shape_offset )
void tile_set_shape_one_way ( int id, int shape_id, bool one_way )
void tile_set_shape_transform ( int id, int shape_id, Transform2D shape_transform )
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 )
void tile_set_tile_mode ( int id, TileMode tilemode )
void tile_set_z_index ( int id, int z_index )

Enumerations

enum BitmaskMode:

  • BITMASK_2X2 = 0
  • BITMASK_3X3_MINIMAL = 1
  • BITMASK_3X3 = 2

enum TileMode:

  • SINGLE_TILE = 0
  • AUTO_TILE = 1
  • ATLAS_TILE = 2

enum AutotileBindings:

  • BIND_TOPLEFT = 1
  • BIND_TOP = 2
  • BIND_TOPRIGHT = 4
  • BIND_LEFT = 8
  • BIND_RIGHT = 32
  • BIND_BOTTOMLEFT = 64
  • BIND_BOTTOM = 128
  • BIND_BOTTOMRIGHT = 256

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.

Method Descriptions

  • bool _is_tile_bound ( int drawn_id, int neighbor_id ) virtual
  • void clear ( )

Clears all tiles.

  • void create_tile ( int id )

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

  • int find_tile_by_name ( String name ) const

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 tile referenced by the given ID.

Returns the light occluder of the tile.

Returns the material of the tile.

  • Color tile_get_modulate ( int id ) const

Returns the name of the tile.

Returns the navigation polygon of the tile.

  • Vector2 tile_get_navigation_polygon_offset ( int id ) const

Returns the offset of the tile’s navigation polygon.

  • Vector2 tile_get_occluder_offset ( int id ) const

Returns the offset of the tile’s light occluder.

  • Rect2 tile_get_region ( int id ) const

Returns the tile sub-region in the texture.

  • int tile_get_shape_count ( int id ) const
  • bool tile_get_shape_one_way ( int id, int shape_id ) const
  • Array tile_get_shapes ( int id ) const

Returns the array of shapes of the tile.

Returns the texture of the tile.

  • Vector2 tile_get_texture_offset ( int id ) const

Returns the texture offset of the tile.

  • int tile_get_z_index ( int id ) const

Sets a light occluder for the tile.

Sets the tile’s material.

  • void tile_set_modulate ( int id, Color color )

Sets the tile’s modulation color.

Sets the tile’s name.

Sets the tile’s navigation polygon.

  • void tile_set_navigation_polygon_offset ( int id, Vector2 navigation_polygon_offset )

Sets an offset for the tile’s navigation polygon.

  • void tile_set_normal_map ( int id, Texture normal_map )

Sets the tile’s normal map texture.

  • 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’s sub-region in the texture. This is common in texture atlases.

  • void tile_set_shape_offset ( int id, int shape_id, Vector2 shape_offset )
  • void tile_set_shape_one_way ( int id, int shape_id, bool one_way )
  • void tile_set_shape_transform ( int id, int shape_id, Transform2D shape_transform )
  • void tile_set_shapes ( int id, Array shapes )

Sets an array of shapes for the tile, enabling collision.

  • void tile_set_texture ( int id, Texture texture )

Sets the tile’s texture.

  • void tile_set_texture_offset ( int id, Vector2 texture_offset )

Sets the tile’s texture offset.

  • void tile_set_tile_mode ( int id, TileMode tilemode )

Sets the tile’s TileMode.

  • void tile_set_z_index ( int id, int z_index )

Sets the tile’s drawing index.