Tile library for tilemaps.
    public class TileSet : Resource

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.

Inheritance Chain

Constructors

    public TileSet()

Methods

    public virtual Vector2 _ForwardSubtileSelection(int autotileId, int bitmask, Object tilemap, Vector2 tileLocation)

    public virtual bool _IsTileBound(int drawnId, int neighborId)

    public void AutotileClearBitmaskMap(int id)

Clears all bitmask info of the autotile.

    public int AutotileGetBitmask(int id, Vector2 coord)

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).

    public BitmaskMode AutotileGetBitmaskMode(int id)

Returns the BitmaskMode of the autotile.

    public Vector2 AutotileGetIconCoordinate(int id)

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 info is incomplete. It will also be used to represent it in the TileSet editor.

    public OccluderPolygon2D AutotileGetLightOccluder(int id, Vector2 coord)

Returns the light occluder of the subtile from an atlas/autotile given its coordinates.

    public NavigationPolygon AutotileGetNavigationPolygon(int id, Vector2 coord)

Returns the navigation polygon of the subtile from an atlas/autotile given its coordinates.

    public Vector2 AutotileGetSize(int id)

Returns the size of the subtiles in an atlas/autotile.

    public int AutotileGetSpacing(int id)

Returns the spacing between subtiles of the atlas/autotile.

    public int AutotileGetSubtilePriority(int id, Vector2 coord)

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.

    public int AutotileGetZIndex(int id, Vector2 coord)

Returns the drawing index of the subtile from an atlas/autotile given its coordinates.

    public void AutotileSetBitmask(int id, Vector2 bitmask, int flag)

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).

    public void AutotileSetBitmaskMode(int id, BitmaskMode mode)

Sets the BitmaskMode of the autotile.

    public void AutotileSetIconCoordinate(int id, Vector2 coord)

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 info is incomplete. It will also be used to represent it in the TileSet editor.

    public void AutotileSetLightOccluder(int id, OccluderPolygon2D lightOccluder, Vector2 coord)

Sets the light occluder of the subtile from an atlas/autotile given its coordinates.

    public void AutotileSetNavigationPolygon(int id, NavigationPolygon navigationPolygon, Vector2 coord)

Sets the navigation polygon of the subtile from an atlas/autotile given its coordinates.

    public void AutotileSetSize(int id, Vector2 size)

Sets the size of the subtiles in an atlas/autotile.

    public void AutotileSetSpacing(int id, int spacing)

Sets the spacing between subtiles of the atlas/autotile.

    public void AutotileSetSubtilePriority(int id, Vector2 coord, int priority)

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.

    public void AutotileSetZIndex(int id, Vector2 coord, int zIndex)

Sets the drawing index of the subtile from an atlas/autotile given its coordinates.

    public void Clear()

Clears all tiles.

    public void CreateTile(int id)

Creates a new tile with the given ID.

    public int FindTileByName(string name)

Returns the first tile matching the given name.

    public int GetLastUnusedTileId()

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

    public Godot.Collections.Array GetTilesIds()

Returns an array of all currently used tile IDs.

    public void RemoveTile(int id)

Removes the given tile ID.

    public void TileAddShape(int id, Shape2D shape, Transform2D shapeTransform, bool oneWay = false, Vector2? autotileCoord = default(Vector2?))

Adds a shape to the tile.

    public OccluderPolygon2D TileGetLightOccluder(int id)

Returns the tile’s light occluder.

    public ShaderMaterial TileGetMaterial(int id)

Returns the tile’s material.

    public Color TileGetModulate(int id)

Returns the tile’s modulation color.

    public string TileGetName(int id)

Returns the tile’s name.

    public NavigationPolygon TileGetNavigationPolygon(int id)

Returns the navigation polygon of the tile.

    public Vector2 TileGetNavigationPolygonOffset(int id)

Returns the offset of the tile’s navigation polygon.

    public Texture TileGetNormalMap(int id)

Returns the tile’s normal map texture.

    public Vector2 TileGetOccluderOffset(int id)

Returns the offset of the tile’s light occluder.

    public Rect2 TileGetRegion(int id)

Returns the tile sub-region in the texture.

    public Shape2D TileGetShape(int id, int shapeId)

Returns a tile’s given shape.

    public int TileGetShapeCount(int id)

Returns the number of shapes assigned to a tile.

    public Vector2 TileGetShapeOffset(int id, int shapeId)

Returns the offset of a tile’s shape.

    public bool TileGetShapeOneWay(int id, int shapeId)

Returns the one-way collision value of a tile’s shape.

    public float TileGetShapeOneWayMargin(int id, int shapeId)

    public Godot.Collections.Array TileGetShapes(int id)

Returns an array of the tile’s shapes.

    public Transform2D TileGetShapeTransform(int id, int shapeId)

Returns the Transform2D of a tile’s shape.

    public Texture TileGetTexture(int id)

Returns the tile’s texture.

    public Vector2 TileGetTextureOffset(int id)

Returns the texture offset of the tile.

    public TileMode TileGetTileMode(int id)

Returns the tile’s TileMode.

    public int TileGetZIndex(int id)

Returns the tile’s z-index (drawing layer).

    public void TileSetLightOccluder(int id, OccluderPolygon2D lightOccluder)

Sets a light occluder for the tile.

    public void TileSetMaterial(int id, ShaderMaterial material)

Sets the tile’s material.

    public void TileSetModulate(int id, Color color)

Sets the tile’s modulation color.

    public void TileSetName(int id, string name)

Sets the tile’s name.

    public void TileSetNavigationPolygon(int id, NavigationPolygon navigationPolygon)

Sets the tile’s navigation polygon.

    public void TileSetNavigationPolygonOffset(int id, Vector2 navigationPolygonOffset)

Sets an offset for the tile’s navigation polygon.

    public void TileSetNormalMap(int id, Texture normalMap)

Sets the tile’s normal map texture.

    public void TileSetOccluderOffset(int id, Vector2 occluderOffset)

Sets an offset for the tile’s light occluder.

    public void TileSetRegion(int id, Rect2 region)

Sets the tile’s sub-region in the texture. This is common in texture atlases.

    public void TileSetShape(int id, int shapeId, Shape2D shape)

Sets a shape for the tile, enabling collision.

    public void TileSetShapeOffset(int id, int shapeId, Vector2 shapeOffset)

Sets the offset of a tile’s shape.

    public void TileSetShapeOneWay(int id, int shapeId, bool oneWay)

Enables one-way collision on a tile’s shape.

    public void TileSetShapeOneWayMargin(int id, int shapeId, float oneWay)

    public void TileSetShapes(int id, Godot.Collections.Array shapes)

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

    public void TileSetShapeTransform(int id, int shapeId, Transform2D shapeTransform)

Sets a Transform2D on a tile’s shape.

    public void TileSetTexture(int id, Texture texture)

Sets the tile’s texture.

    public void TileSetTextureOffset(int id, Vector2 textureOffset)

Sets the tile’s texture offset.

    public void TileSetTileMode(int id, TileMode tilemode)

Sets the tile’s TileMode.

    public void TileSetZIndex(int id, int zIndex)

Sets the tile’s drawing index.

Inner Types

AutotileBindings

Name Value Description
Topleft 1  
Top 2  
Topright 4  
Left 8  
Right 32  
Bottomleft 64  
Bottom 128  
Bottomright 256  

BitmaskMode

Name Value Description
Bitmask2x2    
Bitmask3x3Minimal    
Bitmask3x3    

TileMode

Name Value Description
SingleTile 0  
AutoTile 1  
AtlasTile 2  
Tags: