HI.
I made a “map.tmx” with tiled. like something below:
<map version="1.0" orientation="orthogonal" width="15" height="10" tilewidth="32" tileheight="32"> <tileset name="Untitled" firstgid="1" tilewidth="32" tileheight="32" spacing="1" margin="1"> <image source="background.png"/> </tileset> <layer name="Background" width="15" height="10"> <data encoding="base64" compression="gzip"> H4sIAAAAAAAAAGNkYGBgIhEzA7EcEHMCsQgQC5GAuZH0wtiMUDMVoHx0DBPHphedLYPDzTA1gmjuEcYhjk0NPrcRwhpoGJ+cOhImxmxqYmL9QwgDAPcfaFxYAgAA </data> </layer> <objectgroup name="Objects" width="0" height="0"> <object name="SpawnPoint" x="0" y="288" width="32" height="32"/> </objectgroup> </map>
Here is the problem with the code below:
`_tileMap = CCTMXTiledMap::tiledMapWithTMXFile("./map.tmx");
_tileMap->layerNamed(“Background”);
this->addChild(_tileMap, -1);
CCTMXObjectGroup* objects = _tileMap->objectGroupNamed(“Objects”);
CCMutableDictionary<std::string, CCString*>* spawnPoint = objects->objectNamed(“SpawnPoint”);
int x = spawnPoint->objectForKey(“x”)->toInt();
int y = spawnPoint->objectForKey(“y”)->toInt();`
Here “y” is always 0.