Coder Social home page Coder Social logo

carabina / sktiledmap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wbcyclist/sktiledmap

0.0 1.0 0.0 49.52 MB

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

License: MIT License

Objective-C 97.83% Ruby 0.75% Python 1.42%

sktiledmap's Introduction

SKTiledMap

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.

sktiledmap's People

Contributors

wbcyclist avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.