<objectgroup name="Objects" width="27" height="20">
<object name="Waypoint0" x="887" y="292"/>
<object name="Waypoint1" x="438" y="296"/>
<object name="Waypoint2" x="429" y="22"/>
<object name="Waypoint3" x="22" y="23"/>
<object name="Waypoint4" x="24" y="493"/>
<object name="Waypoint5" x="433" y="497"/>
<object name="Waypoint6" x="437" y="337"/>
<object name="Waypoint7" x="888" y="339"/>
</objectgroup>
遍历多个对象:
auto *objects = this->tileMap->objectGroupNamed("Objects");
std::string stringWithFormat = "Waypoint";
int wayPointCounter = 0;
ValueMap wayPoint;
wayPoint = objects->objectNamed(stringWithFormat + std::to_string(wayPointCounter));
while (wayPoint.begin()!= wayPoint.end())
{
int x = wayPoint.at("x").asInt();
int y = wayPoint.at("y").asInt();
wayPointCounter++;
wayPoint = objects->objectNamed(stringWithFormat + std::to_string(wayPointCounter));
}
获取GID键值:
int tileGid = this->background->getTileGIDAt(point);
Value props = this->tileMap->getPropertiesForGID(tileGid);
ValueMap map = props.asValueMap();
int type_int;
type_int = map.at("buildable").asInt();