Skip to content
Michael Fessenden edited this page Sep 21, 2017 · 4 revisions

Welcome to the SKTiled wiki!

What's New

General Improvements

  • better group layer support
    • child layer offsets render correctly
    • hierarchical layer search
  • text object support
  • tile object support
  • better asynchronous map rendering
    • tilemap is now fully rendered when returned (issue #3)
  • better hexagonal coordinate conversion (issue #9)
  • better debugging visualizations
  • support for custom user objects
  • new protocol for interacting with the camera: SKTiledSceneCameraDelegate
  • animated tiles are now updated via the SKTilemap.update(_:) method
    • changing the tilemap's speed attribute affects tile animation speed
    • tile animations can even play backwards if speed is < 0
  • functions to help alleviate tile seams (or "cracking")
  • tile object tile data can be accessed via SKTileObject.tileData (issue #15)

OS Compatibility

macOS target now requires 10.12.

API Changes

The API has gotten a significant overhaul, mainly to support group layers in Tiled 1.0.

As layers & groups can share names and index values, SKTilemap and SKTiledLayerObject methods that search based on name or index will now return an array:

// old way
if let groundLayer = tilemap.getLayer(named: "Ground") as? SKTileLayer {
    groundLayer.offset.x = 4.0
}

// new way
if let groundLayer = tilemap.getLayers(named: "Ground").first as? SKTileLayer {
    groundLayer.offset.x = 4.0
}

New methods take an optional recursive argument that will search the entire layer tree. When false, only top-level layers will be returned:

Group Layers

// query top-level layers
let topLevelLayers = tilemap.getLayers(recursive: false)
print(topLevelLayers.map { $0.layerName })
// ["Skyway", "Buildings", "Terrain"]

// query all layers
let allLayers = tilemap.getLayers(recursive: true)
print(allLayers.map { $0.layerName })
// ["Skyway", "Paths", "Trees", "Buildings", "Roof", "Walls", "Foundation", "Terrain", "Ground", "Water"]

See the CHANGELOG for a complete list of changes.

GameplayKit

SKTiled now has support for Apple's GameplayKit. Navigation graphs can easily be built for tile layers based on tile attributes:

let walkable  = tileLayer.getTiles().filter { $0.tileData.walkable == true }
let obstacles = tileLayer.getTiles().filter { $0.tileData.obstacle == true }
let graph = tileLayer.initializeGraph(walkable: walkable, obstacles: obstacles, diagonalsAllowed: false)!

See the GameplayKit section for more details.

New Object Types

SKTiled now supports tile and text text object types.

See the objects page for more info.

Tile Objects

Tile Objects

Tiled tile objects are now supported. Objects assigned a tile id will render the associated tile within the object bounds, including animated textures.

Text Objects

Text Objects

Tiled text objects are now supported. Objects assigned text properties will automatically render text within the shape's bounds. Changing the SKTileObject.text attribute (or any of the font attributes) will automatically redraw the object, allowing for easy creation of dynamic labels.

Custom Classes

The SKTilemapDelegate protocol has new methods for users to easily use their own classes for tile and vector objects, as well as custom GKGridGraphNode objects.

See the extending section for more info.