Hi,
I have defined a property as tag
in tiled map editor, and what to retrieve that in cocos2dx
Here is how I do that:
for (int h=0; h< size.height; h++){
for (int w=0;w<size.width; w++){
auto sprite = layer->tileAt(Vec2(w,h));
auto gid = layer->getTileGIDAt(Vec2(w,h));
Value v = tmap->getPropertiesForGID(gid);
ValueMap m = v.asValueMap();
auto tag = m.at("tag");
if (!tag.isNull()) {
CCLOG(" tag string is %s", tag.asString());
}
}
}
I was expecting the output to be like blue, gray, black....
which is the tag I put in the properties of the tiled sprite, but the actually out is some thing like:
tag string is ?SEgray
Some thing like that
I also tried this:
tag.asString();
But that doesn’t turn out to be right either.