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); }
时间: 2024-11-01 12:59:18