2
0

TileSetSource.xml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TileSetSource" inherits="Resource" version="4.0">
  3. <brief_description>
  4. Exposes a set of tiles for a [TileSet] resource.
  5. </brief_description>
  6. <description>
  7. Exposes a set of tiles for a [TileSet] resource.
  8. 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.
  9. 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.
  10. You can iterate over all tiles exposed by a TileSetSource by first iterating over coordinates IDs using [method get_tiles_count] and [method get_tile_id], then over alternative IDs using [method get_alternative_tiles_count] and [method get_alternative_tile_id].
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <methods>
  15. <method name="get_alternative_tile_id" qualifiers="const">
  16. <return type="int" />
  17. <argument index="0" name="atlas_coords" type="Vector2i" />
  18. <argument index="1" name="index" type="int" />
  19. <description>
  20. Returns the alternative ID for the tile with coordinates ID [code]atlas_coords[/code] at index [code]index[/code].
  21. </description>
  22. </method>
  23. <method name="get_alternative_tiles_count" qualifiers="const">
  24. <return type="int" />
  25. <argument index="0" name="atlas_coords" type="Vector2i" />
  26. <description>
  27. Returns the number of alternatives tiles for the coordinates ID [code]atlas_coords[/code].
  28. For [TileSetAtlasSource], this always return at least 1, as the base tile with ID 0 is always part of the alternatives list.
  29. Returns -1 if there is not tile at the given coords.
  30. </description>
  31. </method>
  32. <method name="get_tile_id" qualifiers="const">
  33. <return type="Vector2i" />
  34. <argument index="0" name="index" type="int" />
  35. <description>
  36. Returns the tile coordinates ID of the tile with index [code]index[/code].
  37. </description>
  38. </method>
  39. <method name="get_tiles_count" qualifiers="const">
  40. <return type="int" />
  41. <description>
  42. Returns how many tiles this atlas source defines (not including alternative tiles).
  43. </description>
  44. </method>
  45. <method name="has_alternative_tile" qualifiers="const">
  46. <return type="bool" />
  47. <argument index="0" name="atlas_coords" type="Vector2i" />
  48. <argument index="1" name="alternative_tile" type="int" />
  49. <description>
  50. Returns if the base tile at coordinates [code]atlas_coords[/code] has an alternative with ID [code]alternative_tile[/code].
  51. </description>
  52. </method>
  53. <method name="has_tile" qualifiers="const">
  54. <return type="bool" />
  55. <argument index="0" name="atlas_coords" type="Vector2i" />
  56. <description>
  57. Returns if this atlas has a tile with coordinates ID [code]atlas_coordinates[/code].
  58. </description>
  59. </method>
  60. </methods>
  61. </class>