// 图层 bool HelloWorld::init() { if ( !CCLayer::init() ) { return false; } CCSize winSize = CCDirector::sharedDirector()->getWinSize(); CCTMXTiledMap *map = CCTMXTiledMap::create("map1.tmx"); this->addChild(map); CCSize mapSize = map->getMapSize(); CCSize tilesSize = map->getTileSize(); CCLOG("mapSize:%f_%f,tilesSize:%f_%f",mapSize.width,mapSize.height,tilesSize.width,tilesSize.height); CCArray *pChildArray = map->getChildren(); CCSpriteBatchNode *child = NULL; CCObject *pObject = NULL; // 遍历每个图块,并且设置抗锯齿 CCARRAY_FOREACH(pChildArray,pObject) { child = (CCSpriteBatchNode *)pObject; if (!child) { break; } else { child->getTexture()->setAntiAliasTexParameters(); } } // 取出图层中的最后一个图块进行操作 CCTMXLayer *layer = map->layerNamed("layer1"); CCSprite *pSpr = layer->tileAt(ccp(9,9)); pSpr->setScale(1); pSpr->setRotation(-90); return true; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。