您的位置:首页 > Web前端 > Node.js

CCSpriteBatchNode读取plist

2014-04-30 14:56 441 查看
//首先将plist读到缓存中

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("popstar.plist", "popstar.png");

//将资源添加到CCSpriteBatchNode里。

CCSpriteBatchNode *aParent = CCSpriteBatchNode::create("popstar.png"); 

addChild(aParent); 

//创建精灵并添加到CCSpriteBatchNode里,1000.png是popstar.plist的一个资源

CCSprite *pFather = CCSprite::createWithSpriteFrameName("1000.png"); 

pFather->setPosition(ccp(200,200)); 

aParent->addChild(pFather); 

如此一来,不管需要显示多少个精灵,相同的精灵只会添加一个。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: