Inherits from KKNode : SKNode
Declared in KKTilemapNode.h

Overview

A tilemap node renders a TMX tilemap. It has KKTilemapTileLayerNode and KKTilempaObjectLayerNode as children which perform each layer’s rendering.

Properties

bounds

The tilemap’s bounds rect in points. The x/width and/or y/height are set to INFINITY if the main layer is set to endless scrolling (horizontal or vertical).

@property (atomic, readonly) CGRect bounds

Return Value

The tilemap’s bounds rect in points. The x/width and/or y/height are set to INFINITY if the main layer is set to endless scrolling (horizontal or vertical).

Declared In

KKTilemapNode.h

gameObjectsLayerNode

The game object layer is the object layer where (most) game objects reside. Usually the layer that scrolls parallel to the main tile layer.

@property (atomic, weak, readonly) KKTilemapObjectLayerNode *gameObjectsLayerNode

Return Value

the “game objects” object layer node.

Declared In

KKTilemapNode.h

mainTileLayerNode

The main layer in a parallaxing tilemap is the layer with a parallax ratio of 1.0f. Otherwise it’s the first tile layer.

@property (atomic, weak, readonly) KKTilemapTileLayerNode *mainTileLayerNode

Return Value

the “main” tile layer node.

Declared In

KKTilemapNode.h

objectLayerNodes

an array containing all object layer nodes

@property (readonly) NSArray *objectLayerNodes

Return Value

an array containing all object layer nodes

Declared In

KKTilemapNode.h

tileLayerNodes

an array containing all tile layer nodes

@property (readonly) NSArray *tileLayerNodes

Return Value

an array containing all tile layer nodes

Declared In

KKTilemapNode.h

tilemap

the tilemap model object containing the tilemap’s data.

@property (atomic) KKTilemap *tilemap

Return Value

the tilemap model object containing the tilemap’s data.

Declared In

KKTilemapNode.h

Class Methods

tilemapWithContentsOfFile:

Creates a tilemap node from a TMX file.

+ (id)tilemapWithContentsOfFile:(NSString *)tmxFile

Parameters

tmxFile

The filename of a TMX file in the bundle or an absolute path to a TMX file.

Return Value

The new instance.

Declared In

KKTilemapNode.h

Instance Methods

enableParallaxScrolling

Enables parallax scrolling which makes other layers follow the main tile layer’s position with parallax offset. Call this after setting up any camera follow object.

- (void)enableParallaxScrolling

Declared In

KKTilemapNode.h

objectLayerNodeNamed:

The name identifying an object layer.

- (KKTilemapObjectLayerNode *)objectLayerNodeNamed:(NSString *)name

Parameters

name

The name identifying an object layer.

Return Value

The object layer node with the name, or nil if there’s no object layer with that name.

Declared In

KKTilemapNode.h

objectNamed:

Searches all object layers for an object with a matching name.

- (KKTilemapObject *)objectNamed:(NSString *)name

Parameters

name

The name identifying the object.

Return Value

The first object (of any object layer) with a matching name, or nil if no such object exists.

Declared In

KKTilemapNode.h

restrictScrollingToMapBoundary

Enables boundary scrolling. This prevents the map’s main tile layer from ever scrolling outside its bounds.

- (void)restrictScrollingToMapBoundary

Declared In

KKTilemapNode.h

restrictScrollingToObject:

Enables boundary scrolling. This prevents the map’s main tile layer from ever scrolling outside the object’s bounds.

- (void)restrictScrollingToObject:(KKTilemapRectangleObject *)object

Declared In

KKTilemapNode.h

tileLayerNodeNamed:

The name identifying a tile layer.

- (KKTilemapTileLayerNode *)tileLayerNodeNamed:(NSString *)name

Parameters

name

The name identifying a tile layer.

Return Value

The tile layer node with the name, or nil if there’s no tile layer with that name.

Declared In

KKTilemapNode.h