JSTileMap usage in swift

545 Views Asked by At

I am trying to add my saved tilemap to my swift project but unfortunately it doesn't work out for me. I have done these things so far:

1. I have imported libz.dylib framework
2. I have a bridging-header file with these two imports:
        #import "JSTileMap.h"
        #import "LFCGzipUtility.h"
3. I have imported JSTileMap files and my tilemap to the project
4. I have imported the tilesets I've used

I have this code so far:

var tileMap = JSTileMap(named: "tilemap.tmx")

override func didMoveToView(view: SKView) {

 self.anchorPoint = CGPoint(x: 0, y: 0)
 tileMap.position = CGPoint(x: 0, y: 0)
 addChild(tileMap)

}

I've checked my file name and yes, it's tilemap.tmx so no typo errors. I can run my project but nothing appears. I get this message in my console though:

2015-05-21 16:38:28.844 PROJECT NAME[7671:507940] SKTexture: Error loading image resource: "PATH-TO-File/spritesheet.png"
2015-05-21 16:38:28.845 PROJECT NAME[7671:507940] texture image: PATH-TO-File/spritesheet.png
Size (128.000000, 128.000000)
2015-05-21 16:38:28.846 PROJECT NAME[7671:507940] SKTexture: Error loading image resource: "PATH-TO-File/backgrounds.png"
2015-05-21 16:38:28.847 PROJECT NAME[7671:507940] texture image: PATH-TO-File/backgrounds.png
Size (128.000000, 128.000000)
2015-05-21 16:38:28.847 PROJECT NAME[7671:507940] Layer Tile Layer 1 has zPosition -20.000000

I would appreciate any kind of help

1

There are 1 best solutions below

0
On BEST ANSWER

You need to make sure the map's assets have the same path in relation to the tmx file (map) as when you created the map.