Any plans to extend TMX support?

Any plans to extend TMX support?
0.0 0


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.



We use CCStringToStringDictionary because in c++, there’s nothing like NSObject which can convert to integar, string, object.
So if you want to extend TMX to support the new designed CCTMXObject, the first step is to wrap a string-to-object hash map structure, use it instead of CCStringToStringDictionary. Then you can convert the objects to any other type such as integars, strings, objects.
Refactoring this class is valuable but a hard work.


Has any work been done on this?