TKMapNodeDelegate Protocol Reference

Conforms to NSObject
Declared in TKMapNode.h

Overview

Protocol for implementing TKMapNode callback methods.

– nodeForObject:objectLayerNode:

Upon map load the delegate is queried whether it would like to create and return a custom node for the given object on the given layer node. Implementing this method overrides the default behavior of creating shape/sprite nodes for objects on object layers.

- (nullable TKNode *)nodeForObject:(nonnull TKObject *)object objectLayerNode:(nonnull TKObjectLayerNode *)objectLayerNode

Parameters

object

The TKObject instance to create a node for.

objectLayerNode

The object is on this layer, and the returned node will be added to this node.

Return Value

The node instance to add to the layer node. Return nil if the object should not have a node or the node’s properties should not be altered.

Discussion

Delegate should return nil if it does not want a node for the given object (ie object ignored, or its data is used otherwise), or if the node should not have its properties altered (by TKObject properties, and the calculated zPosition based on the node’s Y coordinate).

Declared In

TKMapNode.h

– didReadMap:

This method is called after the TKMap instance was loaded from a TMX file and before the map is rendered the first time. Override this method in a subclass to perform any post-processing, such as generating map content at runtime.

- (void)didReadMap:(nonnull TKMap *)map

Parameters

map

The map model that was read.

Declared In

TKMapNode.h