class_tilesetsource.rst 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TileSetSource.xml.
  6. .. _class_TileSetSource:
  7. TileSetSource
  8. =============
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`TileSetAtlasSource<class_TileSetAtlasSource>`, :ref:`TileSetScenesCollectionSource<class_TileSetScenesCollectionSource>`
  11. Exposes a set of tiles for a :ref:`TileSet<class_TileSet>` resource.
  12. Description
  13. -----------
  14. Exposes a set of tiles for a :ref:`TileSet<class_TileSet>` resource.
  15. 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 :ref:`TileSetAtlasSource<class_TileSetAtlasSource>` class.
  16. 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.
  17. You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using :ref:`get_tiles_count<class_TileSetSource_method_get_tiles_count>` and :ref:`get_tile_id<class_TileSetSource_method_get_tile_id>`, then over alternative IDs using :ref:`get_alternative_tiles_count<class_TileSetSource_method_get_alternative_tiles_count>` and :ref:`get_alternative_tile_id<class_TileSetSource_method_get_alternative_tile_id>`.
  18. Methods
  19. -------
  20. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_alternative_tile_id<class_TileSetSource_method_get_alternative_tile_id>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` index **)** |const| |
  22. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_alternative_tiles_count<class_TileSetSource_method_get_alternative_tiles_count>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  24. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector2i<class_Vector2i>` | :ref:`get_tile_id<class_TileSetSource_method_get_tile_id>` **(** :ref:`int<class_int>` index **)** |const| |
  26. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`get_tiles_count<class_TileSetSource_method_get_tiles_count>` **(** **)** |const| |
  28. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`has_alternative_tile<class_TileSetSource_method_has_alternative_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)** |const| |
  30. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`has_tile<class_TileSetSource_method_has_tile>` **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const| |
  32. +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. Method Descriptions
  34. -------------------
  35. .. _class_TileSetSource_method_get_alternative_tile_id:
  36. - :ref:`int<class_int>` **get_alternative_tile_id** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` index **)** |const|
  37. Returns the alternative ID for the tile with coordinates ID ``atlas_coords`` at index ``index``.
  38. ----
  39. .. _class_TileSetSource_method_get_alternative_tiles_count:
  40. - :ref:`int<class_int>` **get_alternative_tiles_count** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  41. Returns the number of alternatives tiles for the coordinates ID ``atlas_coords``.
  42. For :ref:`TileSetAtlasSource<class_TileSetAtlasSource>`, this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
  43. Returns -1 if there is not tile at the given coords.
  44. ----
  45. .. _class_TileSetSource_method_get_tile_id:
  46. - :ref:`Vector2i<class_Vector2i>` **get_tile_id** **(** :ref:`int<class_int>` index **)** |const|
  47. Returns the tile coordinates ID of the tile with index ``index``.
  48. ----
  49. .. _class_TileSetSource_method_get_tiles_count:
  50. - :ref:`int<class_int>` **get_tiles_count** **(** **)** |const|
  51. Returns how many tiles this atlas source defines (not including alternative tiles).
  52. ----
  53. .. _class_TileSetSource_method_has_alternative_tile:
  54. - :ref:`bool<class_bool>` **has_alternative_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords, :ref:`int<class_int>` alternative_tile **)** |const|
  55. Returns if the base tile at coordinates ``atlas_coords`` has an alternative with ID ``alternative_tile``.
  56. ----
  57. .. _class_TileSetSource_method_has_tile:
  58. - :ref:`bool<class_bool>` **has_tile** **(** :ref:`Vector2i<class_Vector2i>` atlas_coords **)** |const|
  59. Returns if this atlas has a tile with coordinates ID ``atlas_coordinates``.
  60. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  61. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  62. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  63. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  64. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  65. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`