Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
TileAnimationMode
TileSetAtlasSource.swift:22enum TileAnimationMode
Cases
case `default`
Tile animations start at same time, looking identical.
case randomStartTimes
Tile animations start at random times, looking varied.
case max
Represents the size of the
TileAnimationMode
enum.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (40) members.
Type members
static let transformFlipH: Int
Represents cell’s horizontal flip flag. Should be used directly with
TileMap
to flip placed tiles by altering their alternative IDs.static let transformFlipV: Int
Represents cell’s vertical flip flag. See
transformFlipH
for usage.static let transformTranspose: Int
Represents cell’s transposed flag. See
transformFlipH
for usage.class var godotClassName: StringName
Instance members
var margins: Vector2i
Margins, in pixels, to offset the origin of the grid in the texture.
var separation: Vector2i
Separation, in pixels, between each tile texture region of the grid.
var texture: Texture2D?
The atlas texture.
var textureRegionSize: Vector2i
The base tile size in the texture (in pixel). This size must be bigger than the TileSet’s
tile_size
value.var useTexturePadding: Bool
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.func clearTilesOutsideTexture(
) 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
hasTilesOutsideTexture
beforehand.func createAlternativeTile(atlasCoords: Vector2i, alternativeIdOverride: Int32
) -> Int32 Creates an alternative tile for the tile at coordinates
atlasCoords
. IfalternativeIdOverride
is -1, give it an automatically generated unique ID, or assigns it the given ID otherwise.func createTile(atlasCoords: Vector2i, size: Vector2i
) Creates a new tile at coordinates
atlasCoords
with the givensize
.func getAtlasGridSize(
) -> Vector2i Returns the atlas grid size, which depends on how many tiles can fit in the texture. It thus depends on the
texture
‘s size, the atlasmargins
, and the tiles’textureRegionSize
.func getNextAlternativeTileId(atlasCoords: Vector2i
) -> Int32 Returns the alternative ID a following call to
createAlternativeTile(atlasCoords:alternativeIdOverride:)
would return.func getRuntimeTexture(
) -> Texture2D? If
useTexturePadding
isfalse
, returnstexture
. Otherwise, returns and internalImageTexture
created that includes the padding.func getRuntimeTileTextureRegion(atlasCoords: Vector2i, frame: Int32
) -> Rect2i Returns the region of the tile at coordinates
atlasCoords
for the givenframe
inside the texture returned bygetRuntimeTexture
.func getTileAnimationColumns(atlasCoords: Vector2i
) -> Int32 Returns how many columns the tile at
atlasCoords
has in its animation layout.func getTileAnimationFrameDuration(atlasCoords: Vector2i, frameIndex: Int32
) -> Double Returns the animation frame duration of frame
frameIndex
for the tile at coordinatesatlasCoords
.func getTileAnimationFramesCount(atlasCoords: Vector2i
) -> Int32 Returns how many animation frames has the tile at coordinates
atlasCoords
.func getTileAnimationMode(atlasCoords: Vector2i
) -> TileSetAtlasSource.TileAnimationMode Returns the
TileAnimationMode
of the tile atatlasCoords
. See alsosetTileAnimationMode(atlasCoords:mode:)
.func getTileAnimationSeparation(atlasCoords: Vector2i
) -> Vector2i Returns the separation (as in the atlas grid) between each frame of an animated tile at coordinates
atlasCoords
.func getTileAnimationSpeed(atlasCoords: Vector2i
) -> Double Returns the animation speed of the tile at coordinates
atlasCoords
.func getTileAnimationTotalDuration(atlasCoords: Vector2i
) -> Double Returns the sum of the sum of the frame durations of the tile at coordinates
atlasCoords
. This value needs to be divided by the animation speed to get the actual animation loop duration.func getTileAtCoords(atlasCoords: Vector2i
) -> Vector2i If there is a tile covering the
atlasCoords
coordinates, returns the top-left coordinates of the tile (thus its coordinate ID). ReturnsVector2i(-1, -1)
otherwise.func getTileData(atlasCoords: Vector2i, alternativeTile: Int32
) -> TileData? Returns the
TileData
object for the given atlas coordinates and alternative ID.func getTileSizeInAtlas(atlasCoords: Vector2i
) -> Vector2i Returns the size of the tile (in the grid coordinates system) at coordinates
atlasCoords
.func getTileTextureRegion(atlasCoords: Vector2i, frame: Int32
) -> Rect2i 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.func getTilesToBeRemovedOnChange(texture: Texture2D?, margins: Vector2i, separation: Vector2i, textureRegionSize: Vector2i
) -> PackedVector2Array Returns an array of tiles coordinates ID that will be automatically removed when modifying one or several of those properties:
texture
,margins
,separation
ortextureRegionSize
. This can be used to undo changes that would have caused tiles data loss.func hasRoomForTile(atlasCoords: Vector2i, size: Vector2i, animationColumns: Int32, animationSeparation: Vector2i, framesCount: Int32, ignoredTile: Vector2i
) -> Bool Returns whether there is enough room in an atlas to create/modify a tile with the given properties. If
ignoredTile
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.func hasTilesOutsideTexture(
) -> Bool Checks if the source has any tiles that don’t fit the texture area (either partially or completely).
func moveTileInAtlas(atlasCoords: Vector2i, newAtlasCoords: Vector2i, newSize: Vector2i
) Move the tile and its alternatives at the
atlasCoords
coordinates to thenewAtlasCoords
coordinates with thenewSize
size. This functions will fail if a tile is already present in the given area.func removeAlternativeTile(atlasCoords: Vector2i, alternativeTile: Int32
) Remove a tile’s alternative with alternative ID
alternativeTile
.func removeTile(atlasCoords: Vector2i
) Remove a tile and its alternative at coordinates
atlasCoords
.func setAlternativeTileId(atlasCoords: Vector2i, alternativeTile: Int32, newId: Int32
) Change a tile’s alternative ID from
alternativeTile
tonewId
.func setTileAnimationColumns(atlasCoords: Vector2i, frameColumns: Int32
) Sets the number of columns in the animation layout of the tile at coordinates
atlasCoords
. If set to 0, then the different frames of the animation are laid out as a single horizontal line in the atlas.func setTileAnimationFrameDuration(atlasCoords: Vector2i, frameIndex: Int32, duration: Double
) Sets the animation frame
duration
of frameframeIndex
for the tile at coordinatesatlasCoords
.func setTileAnimationFramesCount(atlasCoords: Vector2i, framesCount: Int32
) Sets how many animation frames the tile at coordinates
atlasCoords
has.func setTileAnimationMode(atlasCoords: Vector2i, mode: TileSetAtlasSource.TileAnimationMode
) Sets the
TileAnimationMode
of the tile atatlasCoords
tomode
. See alsogetTileAnimationMode(atlasCoords:)
.func setTileAnimationSeparation(atlasCoords: Vector2i, separation: Vector2i
) Sets the margin (in grid tiles) between each tile in the animation layout of the tile at coordinates
atlasCoords
has.func setTileAnimationSpeed(atlasCoords: Vector2i, speed: Double
) Sets the animation speed of the tile at coordinates
atlasCoords
has.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.