:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/TileSetAtlasSource.xml. .. _class_TileSetAtlasSource: TileSetAtlasSource ================== **Inherits:** :ref:`TileSetSource` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Exposes a 2D atlas texture as a set of tiles for a :ref:`TileSet` resource. .. rst-class:: classref-introduction-group Description ----------- An atlas is a grid of tiles laid out on a texture. Each tile in the grid must be exposed using :ref:`create_tile()`. Those tiles are then indexed using their coordinates in the grid. Each tile can also have a size in the grid coordinates, making it more or less cells in the atlas. Alternatives version of a tile can be created using :ref:`create_alternative_tile()`, which are then indexed using an alternative ID. The main tile (the one in the grid), is accessed with an alternative ID equal to 0. Each tile alternate has a set of properties that is defined by the source's :ref:`TileSet` layers. Those properties are stored in a TileData object that can be accessed and modified using :ref:`get_tile_data()`. As TileData properties are stored directly in the TileSetAtlasSource resource, their properties might also be set using ``TileSetAtlasSource.set("://")``. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ | :ref:`Vector2i` | :ref:`margins` | ``Vector2i(0, 0)`` | +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ | :ref:`Vector2i` | :ref:`separation` | ``Vector2i(0, 0)`` | +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ | :ref:`Texture2D` | :ref:`texture` | | +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ | :ref:`Vector2i` | :ref:`texture_region_size` | ``Vector2i(16, 16)`` | +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ | :ref:`bool` | :ref:`use_texture_padding` | ``true`` | +-----------------------------------+-----------------------------------------------------------------------------------+----------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`clear_tiles_outside_texture`\ (\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`create_alternative_tile`\ (\ atlas_coords\: :ref:`Vector2i`, alternative_id_override\: :ref:`int` = -1\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`create_tile`\ (\ atlas_coords\: :ref:`Vector2i`, size\: :ref:`Vector2i` = Vector2i(1, 1)\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2i` | :ref:`get_atlas_grid_size`\ (\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_next_alternative_tile_id`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture2D` | :ref:`get_runtime_texture`\ (\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2i` | :ref:`get_runtime_tile_texture_region`\ (\ atlas_coords\: :ref:`Vector2i`, frame\: :ref:`int`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_tile_animation_columns`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_tile_animation_frame_duration`\ (\ atlas_coords\: :ref:`Vector2i`, frame_index\: :ref:`int`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_tile_animation_frames_count`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`TileAnimationMode` | :ref:`get_tile_animation_mode`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2i` | :ref:`get_tile_animation_separation`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_tile_animation_speed`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_tile_animation_total_duration`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2i` | :ref:`get_tile_at_coords`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`TileData` | :ref:`get_tile_data`\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2i` | :ref:`get_tile_size_in_atlas`\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Rect2i` | :ref:`get_tile_texture_region`\ (\ atlas_coords\: :ref:`Vector2i`, frame\: :ref:`int` = 0\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedVector2Array` | :ref:`get_tiles_to_be_removed_on_change`\ (\ texture\: :ref:`Texture2D`, margins\: :ref:`Vector2i`, separation\: :ref:`Vector2i`, texture_region_size\: :ref:`Vector2i`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_room_for_tile`\ (\ atlas_coords\: :ref:`Vector2i`, size\: :ref:`Vector2i`, animation_columns\: :ref:`int`, animation_separation\: :ref:`Vector2i`, frames_count\: :ref:`int`, ignored_tile\: :ref:`Vector2i` = Vector2i(-1, -1)\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`has_tiles_outside_texture`\ (\ ) |const| | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`move_tile_in_atlas`\ (\ atlas_coords\: :ref:`Vector2i`, new_atlas_coords\: :ref:`Vector2i` = Vector2i(-1, -1), new_size\: :ref:`Vector2i` = Vector2i(-1, -1)\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_alternative_tile`\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_tile`\ (\ atlas_coords\: :ref:`Vector2i`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_alternative_tile_id`\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`, new_id\: :ref:`int`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_columns`\ (\ atlas_coords\: :ref:`Vector2i`, frame_columns\: :ref:`int`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_frame_duration`\ (\ atlas_coords\: :ref:`Vector2i`, frame_index\: :ref:`int`, duration\: :ref:`float`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_frames_count`\ (\ atlas_coords\: :ref:`Vector2i`, frames_count\: :ref:`int`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_mode`\ (\ atlas_coords\: :ref:`Vector2i`, mode\: :ref:`TileAnimationMode`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_separation`\ (\ atlas_coords\: :ref:`Vector2i`, separation\: :ref:`Vector2i`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_tile_animation_speed`\ (\ atlas_coords\: :ref:`Vector2i`, speed\: :ref:`float`\ ) | +---------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_TileSetAtlasSource_TileAnimationMode: .. rst-class:: classref-enumeration enum **TileAnimationMode**: :ref:`🔗` .. _class_TileSetAtlasSource_constant_TILE_ANIMATION_MODE_DEFAULT: .. rst-class:: classref-enumeration-constant :ref:`TileAnimationMode` **TILE_ANIMATION_MODE_DEFAULT** = ``0`` Tile animations start at same time, looking identical. .. _class_TileSetAtlasSource_constant_TILE_ANIMATION_MODE_RANDOM_START_TIMES: .. rst-class:: classref-enumeration-constant :ref:`TileAnimationMode` **TILE_ANIMATION_MODE_RANDOM_START_TIMES** = ``1`` Tile animations start at random times, looking varied. .. _class_TileSetAtlasSource_constant_TILE_ANIMATION_MODE_MAX: .. rst-class:: classref-enumeration-constant :ref:`TileAnimationMode` **TILE_ANIMATION_MODE_MAX** = ``2`` Represents the size of the :ref:`TileAnimationMode` enum. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Constants --------- .. _class_TileSetAtlasSource_constant_TRANSFORM_FLIP_H: .. rst-class:: classref-constant **TRANSFORM_FLIP_H** = ``4096`` :ref:`🔗` Represents cell's horizontal flip flag. Should be used directly with :ref:`TileMapLayer` to flip placed tiles by altering their alternative IDs. :: var alternate_id = $TileMapLayer.get_cell_alternative_tile(Vector2i(2, 2)) if not alternate_id & TileSetAtlasSource.TRANSFORM_FLIP_H: # If tile is not already flipped, flip it. $TileMapLayer.set_cell(Vector2i(2, 2), source_id, atlas_coords, alternate_id | TileSetAtlasSource.TRANSFORM_FLIP_H) \ **Note:** These transformations can be combined to do the equivalent of 0, 90, 180, and 270 degree rotations, as shown below: :: enum TileTransform { ROTATE_0 = 0, ROTATE_90 = TileSetAtlasSource.TRANSFORM_TRANSPOSE | TileSetAtlasSource.TRANSFORM_FLIP_H, ROTATE_180 = TileSetAtlasSource.TRANSFORM_FLIP_H | TileSetAtlasSource.TRANSFORM_FLIP_V, ROTATE_270 = TileSetAtlasSource.TRANSFORM_TRANSPOSE | TileSetAtlasSource.TRANSFORM_FLIP_V, } .. _class_TileSetAtlasSource_constant_TRANSFORM_FLIP_V: .. rst-class:: classref-constant **TRANSFORM_FLIP_V** = ``8192`` :ref:`🔗` Represents cell's vertical flip flag. See :ref:`TRANSFORM_FLIP_H` for usage. .. _class_TileSetAtlasSource_constant_TRANSFORM_TRANSPOSE: .. rst-class:: classref-constant **TRANSFORM_TRANSPOSE** = ``16384`` :ref:`🔗` Represents cell's transposed flag. See :ref:`TRANSFORM_FLIP_H` for usage. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_TileSetAtlasSource_property_margins: .. rst-class:: classref-property :ref:`Vector2i` **margins** = ``Vector2i(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_margins**\ (\ value\: :ref:`Vector2i`\ ) - :ref:`Vector2i` **get_margins**\ (\ ) Margins, in pixels, to offset the origin of the grid in the texture. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_property_separation: .. rst-class:: classref-property :ref:`Vector2i` **separation** = ``Vector2i(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_separation**\ (\ value\: :ref:`Vector2i`\ ) - :ref:`Vector2i` **get_separation**\ (\ ) Separation, in pixels, between each tile texture region of the grid. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_property_texture: .. rst-class:: classref-property :ref:`Texture2D` **texture** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_texture**\ (\ value\: :ref:`Texture2D`\ ) - :ref:`Texture2D` **get_texture**\ (\ ) The atlas texture. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_property_texture_region_size: .. rst-class:: classref-property :ref:`Vector2i` **texture_region_size** = ``Vector2i(16, 16)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_texture_region_size**\ (\ value\: :ref:`Vector2i`\ ) - :ref:`Vector2i` **get_texture_region_size**\ (\ ) The base tile size in the texture (in pixel). This size must be bigger than or equal to the TileSet's ``tile_size`` value. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_property_use_texture_padding: .. rst-class:: classref-property :ref:`bool` **use_texture_padding** = ``true`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_use_texture_padding**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **get_use_texture_padding**\ (\ ) If ``true``, generates an internal texture with an additional one pixel padding around each tile. Texture padding avoids a common artifact where lines appear between tiles. Disabling this setting might lead a small performance improvement, as generating the internal texture requires both memory and processing time when the TileSetAtlasSource resource is modified. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_TileSetAtlasSource_method_clear_tiles_outside_texture: .. rst-class:: classref-method |void| **clear_tiles_outside_texture**\ (\ ) :ref:`🔗` Removes all tiles that don't fit the available texture area. This method iterates over all the source's tiles, so it's advised to use :ref:`has_tiles_outside_texture()` beforehand. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_create_alternative_tile: .. rst-class:: classref-method :ref:`int` **create_alternative_tile**\ (\ atlas_coords\: :ref:`Vector2i`, alternative_id_override\: :ref:`int` = -1\ ) :ref:`🔗` Creates an alternative tile for the tile at coordinates ``atlas_coords``. If ``alternative_id_override`` is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise. Returns the new alternative identifier, or -1 if the alternative could not be created with a provided ``alternative_id_override``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_create_tile: .. rst-class:: classref-method |void| **create_tile**\ (\ atlas_coords\: :ref:`Vector2i`, size\: :ref:`Vector2i` = Vector2i(1, 1)\ ) :ref:`🔗` Creates a new tile at coordinates ``atlas_coords`` with the given ``size``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_atlas_grid_size: .. rst-class:: classref-method :ref:`Vector2i` **get_atlas_grid_size**\ (\ ) |const| :ref:`🔗` Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the :ref:`texture`'s size, the atlas :ref:`margins`, and the tiles' :ref:`texture_region_size`. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_next_alternative_tile_id: .. rst-class:: classref-method :ref:`int` **get_next_alternative_tile_id**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the alternative ID a following call to :ref:`create_alternative_tile()` would return. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_runtime_texture: .. rst-class:: classref-method :ref:`Texture2D` **get_runtime_texture**\ (\ ) |const| :ref:`🔗` If :ref:`use_texture_padding` is ``false``, returns :ref:`texture`. Otherwise, returns and internal :ref:`ImageTexture` created that includes the padding. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_runtime_tile_texture_region: .. rst-class:: classref-method :ref:`Rect2i` **get_runtime_tile_texture_region**\ (\ atlas_coords\: :ref:`Vector2i`, frame\: :ref:`int`\ ) |const| :ref:`🔗` Returns the region of the tile at coordinates ``atlas_coords`` for the given ``frame`` inside the texture returned by :ref:`get_runtime_texture()`. \ **Note:** If :ref:`use_texture_padding` is ``false``, returns the same as :ref:`get_tile_texture_region()`. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_columns: .. rst-class:: classref-method :ref:`int` **get_tile_animation_columns**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns how many columns the tile at ``atlas_coords`` has in its animation layout. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_frame_duration: .. rst-class:: classref-method :ref:`float` **get_tile_animation_frame_duration**\ (\ atlas_coords\: :ref:`Vector2i`, frame_index\: :ref:`int`\ ) |const| :ref:`🔗` Returns the animation frame duration of frame ``frame_index`` for the tile at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_frames_count: .. rst-class:: classref-method :ref:`int` **get_tile_animation_frames_count**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns how many animation frames has the tile at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_mode: .. rst-class:: classref-method :ref:`TileAnimationMode` **get_tile_animation_mode**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the tile animation mode of the tile at ``atlas_coords``. See also :ref:`set_tile_animation_mode()`. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_separation: .. rst-class:: classref-method :ref:`Vector2i` **get_tile_animation_separation**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the separation (as in the atlas grid) between each frame of an animated tile at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_speed: .. rst-class:: classref-method :ref:`float` **get_tile_animation_speed**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the animation speed of the tile at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_animation_total_duration: .. rst-class:: classref-method :ref:`float` **get_tile_animation_total_duration**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the sum of the sum of the frame durations of the tile at coordinates ``atlas_coords``. This value needs to be divided by the animation speed to get the actual animation loop duration. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_at_coords: .. rst-class:: classref-method :ref:`Vector2i` **get_tile_at_coords**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` If there is a tile covering the ``atlas_coords`` coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). Returns ``Vector2i(-1, -1)`` otherwise. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_data: .. rst-class:: classref-method :ref:`TileData` **get_tile_data**\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`\ ) |const| :ref:`🔗` Returns the :ref:`TileData` object for the given atlas coordinates and alternative ID. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_size_in_atlas: .. rst-class:: classref-method :ref:`Vector2i` **get_tile_size_in_atlas**\ (\ atlas_coords\: :ref:`Vector2i`\ ) |const| :ref:`🔗` Returns the size of the tile (in the grid coordinates system) at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tile_texture_region: .. rst-class:: classref-method :ref:`Rect2i` **get_tile_texture_region**\ (\ atlas_coords\: :ref:`Vector2i`, frame\: :ref:`int` = 0\ ) |const| :ref:`🔗` Returns a tile's texture region in the atlas texture. For animated tiles, a ``frame`` argument might be provided for the different frames of the animation. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_get_tiles_to_be_removed_on_change: .. rst-class:: classref-method :ref:`PackedVector2Array` **get_tiles_to_be_removed_on_change**\ (\ texture\: :ref:`Texture2D`, margins\: :ref:`Vector2i`, separation\: :ref:`Vector2i`, texture_region_size\: :ref:`Vector2i`\ ) :ref:`🔗` Returns an array of tiles coordinates ID that will be automatically removed when modifying one or several of those properties: ``texture``, ``margins``, ``separation`` or ``texture_region_size``. This can be used to undo changes that would have caused tiles data loss. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_has_room_for_tile: .. rst-class:: classref-method :ref:`bool` **has_room_for_tile**\ (\ atlas_coords\: :ref:`Vector2i`, size\: :ref:`Vector2i`, animation_columns\: :ref:`int`, animation_separation\: :ref:`Vector2i`, frames_count\: :ref:`int`, ignored_tile\: :ref:`Vector2i` = Vector2i(-1, -1)\ ) |const| :ref:`🔗` Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If ``ignored_tile`` is provided, act as is the given tile was not present in the atlas. This may be used when you want to modify a tile's properties. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_has_tiles_outside_texture: .. rst-class:: classref-method :ref:`bool` **has_tiles_outside_texture**\ (\ ) |const| :ref:`🔗` Checks if the source has any tiles that don't fit the texture area (either partially or completely). .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_move_tile_in_atlas: .. rst-class:: classref-method |void| **move_tile_in_atlas**\ (\ atlas_coords\: :ref:`Vector2i`, new_atlas_coords\: :ref:`Vector2i` = Vector2i(-1, -1), new_size\: :ref:`Vector2i` = Vector2i(-1, -1)\ ) :ref:`🔗` Move the tile and its alternatives at the ``atlas_coords`` coordinates to the ``new_atlas_coords`` coordinates with the ``new_size`` size. This functions will fail if a tile is already present in the given area. If ``new_atlas_coords`` is ``Vector2i(-1, -1)``, keeps the tile's coordinates. If ``new_size`` is ``Vector2i(-1, -1)``, keeps the tile's size. To avoid an error, first check if a move is possible using :ref:`has_room_for_tile()`. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_remove_alternative_tile: .. rst-class:: classref-method |void| **remove_alternative_tile**\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`\ ) :ref:`🔗` Remove a tile's alternative with alternative ID ``alternative_tile``. Calling this function with ``alternative_tile`` equals to 0 will fail, as the base tile alternative cannot be removed. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_remove_tile: .. rst-class:: classref-method |void| **remove_tile**\ (\ atlas_coords\: :ref:`Vector2i`\ ) :ref:`🔗` Remove a tile and its alternative at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_alternative_tile_id: .. rst-class:: classref-method |void| **set_alternative_tile_id**\ (\ atlas_coords\: :ref:`Vector2i`, alternative_tile\: :ref:`int`, new_id\: :ref:`int`\ ) :ref:`🔗` Change a tile's alternative ID from ``alternative_tile`` to ``new_id``. Calling this function with ``new_id`` of 0 will fail, as the base tile alternative cannot be moved. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_columns: .. rst-class:: classref-method |void| **set_tile_animation_columns**\ (\ atlas_coords\: :ref:`Vector2i`, frame_columns\: :ref:`int`\ ) :ref:`🔗` Sets the number of columns in the animation layout of the tile at coordinates ``atlas_coords``. If set to 0, then the different frames of the animation are laid out as a single horizontal line in the atlas. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_frame_duration: .. rst-class:: classref-method |void| **set_tile_animation_frame_duration**\ (\ atlas_coords\: :ref:`Vector2i`, frame_index\: :ref:`int`, duration\: :ref:`float`\ ) :ref:`🔗` Sets the animation frame ``duration`` of frame ``frame_index`` for the tile at coordinates ``atlas_coords``. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_frames_count: .. rst-class:: classref-method |void| **set_tile_animation_frames_count**\ (\ atlas_coords\: :ref:`Vector2i`, frames_count\: :ref:`int`\ ) :ref:`🔗` Sets how many animation frames the tile at coordinates ``atlas_coords`` has. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_mode: .. rst-class:: classref-method |void| **set_tile_animation_mode**\ (\ atlas_coords\: :ref:`Vector2i`, mode\: :ref:`TileAnimationMode`\ ) :ref:`🔗` Sets the tile animation mode of the tile at ``atlas_coords`` to ``mode``. See also :ref:`get_tile_animation_mode()`. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_separation: .. rst-class:: classref-method |void| **set_tile_animation_separation**\ (\ atlas_coords\: :ref:`Vector2i`, separation\: :ref:`Vector2i`\ ) :ref:`🔗` Sets the margin (in grid tiles) between each tile in the animation layout of the tile at coordinates ``atlas_coords`` has. .. rst-class:: classref-item-separator ---- .. _class_TileSetAtlasSource_method_set_tile_animation_speed: .. rst-class:: classref-method |void| **set_tile_animation_speed**\ (\ atlas_coords\: :ref:`Vector2i`, speed\: :ref:`float`\ ) :ref:`🔗` Sets the animation speed of the tile at coordinates ``atlas_coords`` has. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`