3

我正在尝试将保存的 tilemap 添加到我的 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

我将不胜感激任何帮助

4

1 回答 1

2

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

于 2015-05-21T17:12:41.310 回答