Inherits from KKTilemapObject : NSObject
Declared in KKTilemapObject.h

Overview

A polygon or polyline object. A polygon is assumed to have its last point connect with the first, the polyline does not. Though it’s up to you how you interpret that. If you need to differentiate between the two, refer to the KTTilemapObject base class' objectType property.

Properties

boundingBox

The polygon’s bounding box. All points of the polygon/polyline lie on or inside the boundingBox. Useful for quickly discarding collision with polygons because if the target object does not intersect with a polygon’s bounding box, it will definitely not intersect with the polygon.

@property (atomic, readonly) CGRect boundingBox

Declared In

KKTilemapObject.h

numberOfPoints

The number of points stored in the points array.

@property (atomic, readonly) unsigned int numberOfPoints

Declared In

KKTilemapObject.h

points

Array of CGPoint containing the points. The points are absolute coordinates with the first point identical to the object’s position.

@property (atomic, readonly) CGPoint *points

Declared In

KKTilemapObject.h

Instance Methods

makePointsFromString:

(TMX Parser Only) Creates the points array from a CGPoint encoded string where string representation of CGPoint are separated by a space character. For example: @“0,0 -80,80 -80,160 0,200 80,200”

- (void)makePointsFromString:(NSString *)string

Parameters

string

The string encoded list of points to be converted to a points array.

Declared In

KKTilemapObject.h

updateBoundingBox

In cases where you manually create or change polygon points you should run updateBoundingBox to update the boundingBox property.

- (void)updateBoundingBox

Declared In

KKTilemapObject.h