Class TileSetSource
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Exposes a set of tiles for a TileSet resource.
Tiles in a source are indexed with two IDs, coordinates ID (of type Vector2i) and an alternative ID (of type int), named according to their use in the TileSetAtlasSource class.
Depending on the TileSet source type, those IDs might have restrictions on their values, this is why the base TileSetSource class only exposes getters for them.
You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using GetTilesCount() and GetTileId(int), then over alternative IDs using GetAlternativeTilesCount(Vector2I) and GetAlternativeTileId(Vector2I, int).
Warning: TileSetSource can only be added to one TileSet at the same time. Calling AddSource(TileSetSource, int) on a second TileSet will remove the source from the first one.
public class TileSetSource : Resource, IDisposable
- Inheritance
-
TileSetSource
- Implements
- Derived
- Inherited Members
Methods
GetAlternativeTileId(Vector2I, int)
Returns the alternative ID for the tile with coordinates ID atlasCoords
at index index
.
public int GetAlternativeTileId(Vector2I atlasCoords, int index)
Parameters
Returns
GetAlternativeTilesCount(Vector2I)
Returns the number of alternatives tiles for the coordinates ID atlasCoords
.
For TileSetAtlasSource, this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
Returns -1 if there is not tile at the given coords.
public int GetAlternativeTilesCount(Vector2I atlasCoords)
Parameters
atlasCoords
Vector2I
Returns
GetTileId(int)
Returns the tile coordinates ID of the tile with index index
.
public Vector2I GetTileId(int index)
Parameters
index
int
Returns
GetTilesCount()
Returns how many tiles this atlas source defines (not including alternative tiles).
public int GetTilesCount()
Returns
HasAlternativeTile(Vector2I, int)
Returns if the base tile at coordinates atlasCoords
has an alternative with ID alternativeTile
.
public bool HasAlternativeTile(Vector2I atlasCoords, int alternativeTile)
Parameters
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
HasTile(Vector2I)
Returns if this atlas has a tile with coordinates ID atlasCoords
.
public bool HasTile(Vector2I atlasCoords)
Parameters
atlasCoords
Vector2I
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.