swift 中的 JSTileMap 用法

JSTileMap usage in swift

我正在尝试将我保存的地图添加到我的 swift 项目中,但遗憾的是它对我来说不起作用。到目前为止我已经做了这些事情:

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

到目前为止我有这个代码:

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)

}

我检查了我的文件名,是的,它是 tilemap.tmx,所以没有拼写错误。我可以 运行 我的项目,但什么也没有出现。不过,我在控制台中收到此消息:

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

如有任何帮助,我将不胜感激

您需要确保地图的资产相对于 tmx 文件(地图)的路径与您创建地图时的路径相同。