Problem with CCTMXObjectGroup

I am trying to load some objects like this:

    CCTMXObjectGroup* solids = map->objectGroupNamed("Solids");
    CCAssert(solids != 0, "'Solids' object group was not found.");
    CCMutableArray* solidObjects = solids->getObjects();

    arraySolids->removeAllObjects();
    while (solidObjects->count() > 0)
    {
        float x = solidObjects->getLastObject()->objectForKey("x")->toFloat();
        float y = solidObjects->getLastObject()->objectForKey("y")->toFloat();
        float w = solidObjects->getLastObject()->objectForKey("width")->toFloat(); 
        float h = solidObjects->getLastObject()->objectForKey("height")->toFloat();
        //float x = solidObjects->getObjectAtIndex(0)->objectForKey("x")->toFloat();
        //float y = solidObjects->getObjectAtIndex(0)->objectForKey("y")->toFloat();
        //float w = solidObjects->getObjectAtIndex(0)->objectForKey("width")->toFloat(); 
        //float h = solidObjects->getObjectAtIndex(0)->objectForKey("height")->toFloat();
        Solid* s = new Solid();
        s->setPosition(ccp(x, y));
        s->width = w;
        s->height = h;
        arraySolids->addObject(s);
        this->addChild(s);

        solidObjects->removeObjectAtIndex(0);
        CCLOG("Solid (%f, %f, %f, %f)", x, y, w, h);
        return true;
    }

The log shows: (800, 448, 64, 32)
If I get the object at the first index, instead, the log shows: (0, 288, 96, 32)

This is what my object group looks like:

The y coordinates are messed up. Can anyone explain why that is?

edit:
Nevermind, The coordinates are different because the parser takes into account that the cocos2d axis is different to the one used in Tiled Map editor.

That leads me to another question. The log shows that the first object’s properties are: (0, 288, 96, 32)
How does it convert between Tiled coordinate space to cocos2d coordinate space? 768-448 = 320. Shouldn’t the y coordinate be 320 and not 288?

I know I said it might be a coincidence, but just to make myself clear I am loading the wrong values.

The log shows (800,448,64,32) but it should be showing (800,288,64,32)

Let me know if you guys need additional information.

edit
So I didn’t realize that the parser automatically converts from Tiled coordinate space to Cocos2d coordinate space, but now I have another question, which is in the first post.

A bit odd. Can you paste your tmx file here, so I can write some code to load it, and find the bug?
I will highly appreciate if you can write a simple demo to reproduce this problem :slight_smile: I need to trace the data in CCTMXTiledMap for more details.