I’d like to use TMX Object layers for defining collision and game entities. As far as I can tell, currently the support is fairly sparse. Cocos loads the Object layers as CCTMXObjectGroup, but the objects themselves are just stored as CCStringToStringDictionary with the x, y, width and height being stored as strings. In the latest Tiled build (not yet released), there is support for polygons (YAY!). I’d like to add support for holding this data pre-parsed to a list of points. I just wanted to check that nobody had already done this, and to run my ideas by the team:
- Objects would be stored as an array of CCTMXObject (new class)
- Existing string only format could be kept to maintain backwards compatibility (necessary?)
- CCTMXObject would have their own CCStringToStringDictionary for properties
- CCTMXObject would store an array of CCPoint to represent the geometry
My main concern is how to represent the Rectangle in an array of points. Possibly the best approach is to treat it as a four sided polygon but have a CCTMXObjectType (point, rectangle, polygon, polyline) and store boundMin and boundMax value on all objects.