Latest 1.0.0
Homepage https://github.com/wbcyclist/SKTiledMap
License MIT
Platforms ios 8.0, osx 10.10, requires ARC
Authors

A TMX TileMap framework for SpriteKit. Supporting iOS 8 and OS X 10.10 and above.

This is a library for parsing the maps generated by Tiled Map Editor.

Installation

  • Cocoapods
    1. pod 'SKTiledMap'
    2. Add #import <SKTiledMap/SKTiledMap.h> to your source file.
  • Manually
    1. Download the latest code version
    2. Open your project in Xcode, then drag and drop Framework/ folder into your project
    3. configure Dependencies
    4. Add #import 'SKTiledMap.h' to your source file.

Basic Usage

SKTMMapLayer *mapLayer = [[SKTMMapLayer alloc] initWithContentsOfFile:@"map.tmx"];
[self addChild:mapLayer];

// get tile layer
SKTMTileLayer *tileLayer = [mapLayer tileLayerWithName:@"Ground"];

// get object layer
SKTMObjectGroupLayer *objLayer = [mapLayer objectLayerWithName:@"Obj"];
// get shape in object layer
SKTMObjectGroupShape *heroObjShape = [objLayer shapeWithName:@"Hero"];
// get custom properties
[heroObjShape.model propertyForName:@"status"];

// get image layer
SKTMImageLayer *imgLayer = [mapLayer imageLayerWithName:@"Background"];

// Coordinates System Convert
CGPoint tilePoint = [mapLayer.mapRenderer screenToTileCoords:CGPointMake(320, 600)];
CGPoint mapPoint = [mapLayer.mapRenderer tileToScreenCoords:CGPointMake(1, 1)];

// more detail you can see in demo or source code.

Features

  • All map types:
    • Orthogonal
    • Isometric
    • Isometric (staggered)
    • Hexagonal (staggered)
  • All TileLayerFormat:
    • XML
    • Base64 (uncompressed)
    • Base64 (gzip compressed)
    • Base64 (zlib compressed)
    • CSV
  • All Tile Render Ways:
    • Stagger Axis (X, Y)
    • Stagger Index (Odd, Even)
    • Tile Render Order (RightDown, RightUp, LeftDown, LeftUp)
    • Flipped/Rotated Tiles Or Objects
  • All ObjectGroup Shape
    • Rectangle
    • Ellipse
    • Polygon
    • Polyline
  • Animated tile support

Roadmap

See the TMX map format reference page.

SKTiledMap(root)
└── Framework
    │
    │-- SKTiledMap.h
    │
    ├── Model
    │   |-- TMXObject
    │   |-- TMXTile
    │   |-- TMXTileset
    │   |-- TMXTileLayer
    │   |-- TMXObjectGroupNode
    │   |-- TMXObjectGroup
    │   |-- TMXImageLayer
    │   |-- TMXMap
    │
    ├── Classes
    │   |-- SKMapRenderer
    │   |-- OrthogonalRenderer
    │   |-- IsometricRenderer
    │   |-- StaggeredRenderer
    │   |-- HexagonalRenderer
    │
    └── SpriteKitNode
        |-- SKTMNode
        |-- SKTMTileNode
        |-- SKTMObjectGroupTile
        |-- SKTMObjectGroupShape
        │
        |-- SKTMLayer
        |-- SKTMTileLayer
        |-- SKTMObjectGroupLayer
        |-- SKTMImageLayer
        |-- SKTMMapLayer

Dependencies

  • Ono for parsing XML
  • libz.dylib
  • SpriteKit.framework

DEMO

SKTiledMap-Mac

  • iOS

SKTiledMap

License

SKTiledMap is released under the MIT license. See LICENSE for details.

Example tileset artwork is appropriated to Steffan (TilemapKit)

Image Attributions

Some screenshots show the open-source Tiled Map Editor. Some images in TilemapKit and on this website are from OpenGameArt.org.

Here’s a full list of OpenGameArt authors/contributors, licenses and source links for the images used by TilemapKit.

Please let me know if you notice any images that may have missing or incorrect attributions, thank you.

Latest podspec

{
    "name": "SKTiledMap",
    "version": "1.0.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "homepage": "https://github.com/wbcyclist/SKTiledMap",
    "authors": {
        "Jasio Woo": "[email protected]"
    },
    "summary": "A TMX Tilemap Framework For SpriteKit. Supporting iOS and OS X",
    "source": {
        "git": "https://github.com/wbcyclist/SKTiledMap.git",
        "tag": "1.0.0"
    },
    "screenshots": [
        "https://raw.githubusercontent.com/wbcyclist/SKTiledMap/master/Screenshot/SKTiledMap-Mac.jpg"
    ],
    "requires_arc": true,
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "public_header_files": "Framework/*.h",
    "source_files": "Framework/SKTiledMap.h",
    "subspecs": [
        {
            "name": "External",
            "ios": {
                "frameworks": [
                    "UIKit",
                    "SpriteKit"
                ]
            },
            "osx": {
                "frameworks": [
                    "AppKit",
                    "SpriteKit"
                ]
            },
            "libraries": "z",
            "public_header_files": "Framework/External/*.h",
            "source_files": "Framework/External/**/*.{h,m}"
        },
        {
            "name": "Model",
            "dependencies": {
                "SKTiledMap/External": [],
                "Ono": []
            },
            "public_header_files": "Framework/Model/*.h",
            "private_header_files": "Framework/Classes/SKMapRenderer.h",
            "source_files": [
                "Framework/Model/**/*.{h,m}",
                "Framework/Classes/SKMapRenderer.h"
            ]
        },
        {
            "name": "SpriteKitNode",
            "dependencies": {
                "SKTiledMap/Model": []
            },
            "source_files": [
                "Framework/SpriteKitNode/**/*.{h,m}",
                "Framework/Classes/**/*.{h,m}"
            ]
        }
    ]
}

Pin It on Pinterest

Share This