CocosCreator 中使用TiledMap, 对象层读不到 Rotation 数据。

看了下源码, CCTMXXMLParser.cpp 如下:

else if (elementName == “object”)
{
TMXObjectGroup* objectGroup = tmxMapInfo->getObjectGroups().back();

    // The value for "type" was blank or not a valid class name
    // Create an instance of TMXObjectInfo to store the object and its properties
    ValueMap dict;
    // Parse everything automatically
    const char* keys[] = {"name", "type", "width", "height", "gid", "id"};

    for (const auto& key : keys)
    {
        Value value = attributeDict[key];
        dict[key] = value;
    }

    // But X and Y since they need special treatment
    // X
    int x = attributeDict["x"].asInt();
    // Y
    int y = attributeDict["y"].asInt();

    Vec2 p(x + objectGroup->getPositionOffset().x, _mapSize.height * _tileSize.height - y  - objectGroup->getPositionOffset().y - attributeDict["height"].asInt());
    p = CC_POINT_PIXELS_TO_POINTS(p);
    dict["x"] = Value(p.x);
    dict["y"] = Value(p.y);

    int width = attributeDict["width"].asInt();
    int height = attributeDict["height"].asInt();
    Size s(width, height);
    s = CC_SIZE_PIXELS_TO_POINTS(s);
    dict["width"] = Value(s.width);
    dict["height"] = Value(s.height);

    // Add the object to the objectGroup
    objectGroup->getObjects().push_back(Value(dict));

    // The parent element is now "object"
    tmxMapInfo->setParentElement(TMXPropertyObject);
}

目前 TiledMap 对 ObjectGroup 支持并不完善,已有计划进行优化。会在后续版本放出。

问题是我现在需要用这个功能,如果地图的对象不能旋转,地图编辑很多做法都用不了,资源量会大增,有什么办法能解决么?

貌似使用定制引擎,然后自己修改也是可以的是吧?

嗯,如果要急用,只能自己定制引擎了。