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.

TiledSceneDelegate Overview

Properties

  • worldNode: Root container node. Tiled assets are parented to this node.
  • cameraNode: Custom scene camera.
  • tilemap: Tile map node.

Instance Methods

Available where Self: SKScene

  • 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.

  • 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.