首页 > 代码库 > cocos2d tiledmap 获取属性

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=http://www.mamicode.com/(CCString*) tiledic->objectForKey("collion");        int mv=mvalue->floatValue();        CCLOG("%d",mv);    }

 

cocos2d tiledmap 获取属性