TiledSceneDelegate
public protocol TiledSceneDelegate : AnyObject
The TiledSceneDelegate
Methods for managing SKTilemap
nodes in an SpriteKit SKScene
scene.
This protocol and the SKTiledScene
objects are included as a suggested way to use the
SKTilemap
class, but are not required.
In this configuration, the tile map is a child of the root node and reference the custom
SKTiledSceneCamera
camera.
Properties
worldNode
: Root container node. Tiled assets are parented to this node.cameraNode
: Custom scene camera.tilemap
: Tile map node.
Instance Methods
load(tmxFile:)
: Load a tilemap from disk.
-
Root container node. Tiled assets are parented to this node.
Declaration
Swift
var worldNode: SKNode! { get set }
-
Custom scene camera.
Declaration
Swift
var cameraNode: SKTiledSceneCamera? { get set }
-
Tile map node.
Declaration
Swift
var tilemap: SKTilemap? { get set }
-
This method loads a named tilemap tmx file, with optional tilesets. Camera properties are added from the tilemap automatically.
Defined in:
extension TiledSceneDelegate where Self: SKScene {}
Declaration
Swift
public func load(tmxFile: String, inDirectory: String? = nil, withTilesets tilesets: [SKTileset] = [], ignoreProperties: Bool = false, loggingLevel: LoggingLevel = TiledGlobals.default.loggingLevel, completion: ((SKTilemap) -> ())? = nil) -> SKTilemap?
Parameters
tmxFile
tilemap file name.
inDirectory
search path for assets.
tilesets
optional pre-loaded tilesets.
ignoreProperties
don’t parse custom properties.
loggingLevel
logging verbosity.
completion
optional completion handler.
Return Value
tilemap instance.
-
load(tmxFile:
Extension methoddelegate: inDirectory: withTilesets: ignoreProperties: loggingLevel: completion: ) This method loads a named tilemap tmx file, with optional tilesets. Camera properties are added from the tilemap automatically.
Defined in:
extension TiledSceneDelegate where Self: SKScene {}
Declaration
Swift
public func load(tmxFile: String, delegate: TilemapDelegate? = nil, inDirectory: String? = nil, withTilesets tilesets: [SKTileset] = [], ignoreProperties: Bool = false, loggingLevel: LoggingLevel = TiledGlobals.default.loggingLevel, completion: ((SKTilemap) -> ())? = nil) -> SKTilemap?
Parameters
tmxFile
tilemap file name.
delegate
optional tilemap delegate instance.
inDirectory
search path for assets.
tilesets
optional pre-loaded tilesets.
ignoreProperties
don’t parse custom properties.
loggingLevel
logging verbosity.
completion
optional completion handler.
Return Value
tilemap instance.