I've been following a tutorial to make tiled map in cocos2d x 3.0 , but i couldnt complete the rest of the tutorial because its for coco2d x 2.0 version,

How can i get a value of property that is stored in an object from TMXObjectGroup variable ? and my code is:

tileMap = cocos2d::TMXTiledMap::create("ground.tmx");
ground = tileMap->layerNamed("ground");

TMXObjectGroup *objects = tileMap->getObjectGroup("objects");
??? sign = objects->getObject("sign");// it return ValueMap not Dictionary ?! 

how can i get a Dictionary of that object so i can get its values ??

ValueMap sign = objects->getObject("sign");
float x = sign["x"].asFloat();
float y = sign["y"].asFloat();
std::string nameAlias =  sign["name_alias"].asString();

ValueMap in cocos2d contains Value type. You can see in CCValue.h for more details.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.