1.读入plist文件
CCSpriteFrameCache *cache=CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile("000.pv.plist");
CCSprite *sprite=CCSprite::createWithSpriteFrame(cache->spriteFrameByName("attack_type1_d_0000.png"));
2.形成CCAnimation
//"attack_type1_d_0000.png""attack_type1_d_0001.png""attack_type1_d_0002.png"...
CCAnimation *HelloWorld::GetAnimate(const char *name,const int count,float delay)
//编号为:0~count-1的png图片形成动画(name为共同前缀)
{
CCArray *a=CCArray::array();
char keyname[100];
for(int i=0;i<6;++i)
{
sprintf(keyname,"%s%d.png",name,i);
a->addObject(cache->spriteFrameByName(keyname));
}
//
CCAnimation *animation = CCAnimation::animationWithSpriteFrames(a,delay);
return animation;
}
3.使用GetAnimate,对一个CCSpri