cocos2d tiledmap 获取属性

    CCTMXTiledMap *map=CCTMXTiledMap::create("1.tmx");
    addChild(map);

    //fight juchi
    CCArray* pChildrenArray=map->getChildren();
    CCSpriteBatchNode* child=NULL;
    CCObject* pObject=NULL;
    CCARRAY_FOREACH(pChildrenArray,pObject)
    {

        child=(CCSpriteBatchNode*)pObject;
        if(!child)
        {
            break;
        }
        child->getTexture()->setAntiAliasTexParameters();
    }
    
    CCTMXLayer*  layer=map->layerNamed("Layer 0");
    CCSize s=layer->getLayerSize();

    CCPoint playerIndex=ccp(0,1);
    int tilegid=layer->tileGIDAt(playerIndex);
    if(tilegid>0)
    {
        CCDictionary *tiledic=(CCDictionary*)map->propertiesForGID(tilegid);
        CCString *mvalue=(CCString*) tiledic->objectForKey("collion");
        int mv=mvalue->floatValue();
        CCLOG("%d",mv);
    }
原文地址:https://www.cnblogs.com/yufenghou/p/4005958.html