Yes, you can, I just started using it yesterday and have not found a problem! Start by importing the JSTileMap files and the libz.dylib framework. Then add the bridge header with the following imports:
#import "JSTileMap.h" #import "LFCGzipUtility.h"
Next, just go into the SKScene file and create the tileMap variable, as shown below:
var tileMap = JSTileMap(named: "tileMap.tmx")
I found that positioning is a bit complicated, so add this too.
self.anchorPoint = CGPoint(x: 0, y: 0) self.position = CGPoint(x: 0, y: 0) //Change the scenes anchor point to the bottom left and position it correctly let rect = tileMap.calculateAccumulatedFrame() //This is not necessarily needed but returns the CGRect actually used by the tileMap, not just the space it could take up. You may want to use it later tileMap.position = CGPoint(x: 0, y: 0) //Position in the bottom left addChild(tileMap) //Add to the scene
EDIT
below is the code that I used to create the SKSpriteNodes floor:
func addFloor() { for var a = 0; a < Int(tileMap.mapSize.width); a++ {
source share