A Swift Package for reading Tiled levels that makes it easy to use with SpriteKit and provides a command line utility that provides (amongst other things) the ability to preview levels directly from Tiled. SKTiledKit is build on top of TiledKit a cross-platform Swift package for reading maps, tilesets and more.
Out of the box (with no specialisation for your particular game) the only code needed to load a level, playing animations would be
// The the map from the Maps folder of the app's bundle
let scene = try Project.default.retrieve(scene: "Level 1", in: "Maps")
// Configure and present the view
scene.scaleMode = .aspectFill
let view = SKView(frame: scene.frame)
view.presentScene(scene)
You can find more information in the SKTIledKIt Documentation. You can actually explore this default behaviour using sktiled, a command line utility included in the package that can be configured as a command in tiled. Here's it running, note that debugging of SpriteKit physics objects is turned on so you can see the collision body for the bomb being trsrc="https://raw.github.com/SwiftStudies/SKTiledKit/main/ted into the generated SKSprite
node.
sk-tiled
More documentation on the command line utilitylink |
Stars: 2 |
Last commit: 3 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics