SKTilesetData
public class SKTilesetData : SKTiledObject
extension SKTilesetData: Hashable
extension SKTilesetData: CustomStringConvertible, CustomDebugStringConvertible
Overview
The SKTilesetData object stores data for a single tileset tile, referencing the tile texture, animation frames (for animated tiles) as well as tile orientation.
Also includes navigation properties for tile accessability, and graph node weight.
Properties
| Property | Description |
|---|---|
| id | Tile id (local) |
| type | Tiled type |
| texture | Tile texture |
| tileOffset | Tile offset |
-
▶︎uuidUnique id.
Declaration
Swift
public var uuid: String -
▶︎idTile id (local).
Declaration
Swift
public var id: Int -
▶︎typeTiled type.
Declaration
Swift
public var type: String! -
▶︎nameTile data name.
Declaration
Swift
public var name: String? { get } -
▶︎textureTile texture.
Declaration
Swift
public var texture: SKTexture! -
▶︎sourceSource image name (collections tileset)
Declaration
Swift
public var source: String! -
Tile occurance probability (parsed from Tiled, not currently used).
Declaration
Swift
public var probability: CGFloat -
Custom Tiled properties.
Declaration
Swift
public var properties: [String : String] -
Node ignores custom properties.
Declaration
Swift
public var ignoreProperties: Bool -
Tile offset.
Declaration
Swift
public var tileOffset: CGPoint -
Render scaling property.
Declaration
Swift
public var renderQuality: CGFloat -
▶︎framesTile animation frame storate.
Declaration
Swift
public var frames: [TileAnimationFrame] { get } -
Indicates the tile is animated.
Declaration
Swift
public var isAnimated: Bool { get } -
Returns an aniamtion action for the tile data.
Declaration
Swift
public var animationAction: SKAction? { get }
-
▶︎walkableTile is walkable.
Declaration
Swift
public var walkable: Bool -
▶︎obstacleTile represents an obstacle.
Declaration
Swift
public var obstacle: Bool -
▶︎weightPathfinding weight.
Declaration
Swift
public var weight: CGFloat -
Collision objects (not yet implemented).
Declaration
Swift
public var collisions: [SKTileObject] -
▶︎globalIDGlobal id for this tile.
Declaration
Swift
public var globalID: Int { get }
-
▶︎init()Initialize an empty data structure.
Declaration
Swift
public init()
-
Add tile animation to the data.
Declaration
Swift
public func addFrame(withID: Int, interval: Int, tileTexture: SKTexture? = nil) -> TileAnimationFrameParameters
withIDIntid for frame.intervalIntframe interval (in milliseconds).tileTextureSKTexture?frame texture.Return Value
TileAnimationFrameanimation frame container. -
Returns an animation frame at the given index.
Declaration
Swift
public func frameAt(index: Int) -> TileAnimationFrame?Parameters
indexIntframe index.Return Value
TileAnimationFrame?animation frame container. -
Force the animated frames to update textuers.
Declaration
Swift
public func forceAnimatedFramesUpdate() -
Set the texture for the tile data.
Declaration
Swift
public func setTexture(_ newTexture: SKTexture?) -> SKTexture?Parameters
textureSKTexture?new texture.Return Value
SKTexture?old texture (if it exists). -
Set the texture for an animated frame at the given index.
Declaration
Swift
public func setTexture(_ texture: SKTexture?, forFrame: Int) -> SKTexture?Parameters
textureSKTexture?new texture.forFrameIntframe index.Return Value
SKTexture?old texture (if it exists). -
Set the duration for an animated frame at the given index.
Declaration
Swift
public func setDuration(interval: Int, forFrame: Int) -> BoolParameters
intervalIntframe interval (in milliseconds).forFrameIntframe index.Return Value
Boolframe duration was set correctly. -
Remove a tile animation frame at a given index.
Declaration
Swift
public func removeFrame(at index: Int) -> TileAnimationFrame?Parameters
atIntframe index.Return Value
TileAnimationFrame?animation frame (if it exists). -
Run tile animation.
Declaration
Swift
public func runAnimation() -
Remove tile animation. Animation is not actually destroyed, but rather blocked.
Declaration
Swift
public func removeAnimation(restore: Bool = false)Parameters
restoreBoolrestore the initial texture.
-
Parse the tile data’s properties value.
Declaration
Swift
public func parseProperties(completion: (() -> Void)?)
-
▶︎localIDLocal id for this tile data.
Declaration
Swift
@available(*, deprecated, renamed: "id") public var localID: Int { get }
View on GitHub
SKTilesetData Class Reference