TKLayer Class Reference

Inherits from NSObject
Conforms to TKPropertiesOwner
Declared in TKLayer.h

Overview

Abstract base class that represents a layer in a TKMap.

Accessing the Layer's Tilemap

  map

Reference to the tilemap the layer is part of.

@property (readonly, weak, nullable) TKMap *map

Declared In

TKLayer.h

Identifying a Layer

  name

The name of the layer.

@property (copy, nonnull) NSString *name

Declared In

TKLayer.h

  type

The TKLayerType of a layer enables you to determine the layer’s class without having to use isKindOfClass. Makes casting to the correct class easier.

@property TKLayerType type

Declared In

TKLayer.h

Rendering Attributes

  offset

The layer’s drawing offset, in points.

@property CGPoint offset

Return Value

The layer’s drawing offset, in points.

Declared In

TKLayer.h

  alpha

How opaque the layer is. Value ranges from 0.0 (fully transparent) to 1.0 (fully opaque).

@property float alpha

Return Value

The alpha (transparency) of the layer.

Discussion

Note: In Tiled it’s called “Opacity”. Alpha better matches SpriteKit’s and Cocoa’s terminology.

Declared In

TKLayer.h

  hidden

Whether the layer and its contents are visible or not.

@property BOOL hidden

Return Value

YES if the layer is hidden (not visible).

Discussion

Note: In Tiled it’s called “Visible” and is the inverse of hidden, which better matches SpriteKit’s and Cocoa’s terminology.

Declared In

TKLayer.h

Layer Properties

  properties

The layer’s TKProperties. Is nil if there aren’t any properties assigned (yet).

@property (nonnull) TKProperties *properties

Declared In

TKLayer.h