I am testing tiled-map game with cocos2d-x, and I want to know how we get the information from the map-level (from .tmx file created with Tiled, map editor tool) in code.
I read tutorial from http://www.raywenderlich.com/1163/how-to-make-a-tile-based-game-with-cocos2d at the setViewPointCenter() function, and saw that it used _tileMap.mapSize
to access the entire tilemap’s size
and
_tileMap.tileSize
to access individual tile’s size.
Both are not available in cocos2d-x, but we still can access via other methods I believe. I also tried _tileMap->propertyNamed("width").toInt()
to try and get the size (width) of entire tilemap, but no success. The same goes for tilemap’s size as I used _tileMap->propertyNamed("tileWidth").toInit()
Any suggestion on how we get those property from .tmx file in code ?
To give you a better idea of what I’m asking, I attached the image for the method I’m working on to retrieve values from the .tmx file instead of hard-coded one.
The comment lines are what I’ve tried but it’s not successful and error kicks in.