Load a .tmx (Tiled Map) in Sprite Kit?

前端 未结 3 1808
眼角桃花
眼角桃花 2020-12-05 14:37

Is there a (preferably easy) way to load a .tmx file in iOS 7\'s Sprite Kit? If not, are there any alternatives?

3条回答
  •  猫巷女王i
    2020-12-05 15:22

    you should use JSTileMap that is designed to work with Sprite Kit

    • add JSTileMap files to your project
    • add libz.dylib to the linked frameworks and libraries section of your project
    • import JSTileMap.h

    and load a map with:

    JSTileMap *tiledMap = [JSTileMap mapNamed:@"mapFileName.tmx"];
    if (tiledMap) [mySKNode addChild:tiledMap];
    

    Here is the source: https://github.com/slycrel/JSTileMap

    Good Luck!!

提交回复
热议问题