CCAnimation animation= animationWithSingleFrames;
CCAnimation HelloWorld::animationWithSingleFrames(char name,int count,float delay)
{
CCSpriteFrameCachecache = CCSpriteFrameCache::sharedSpriteFrameCache();
CCArray* animFrames = CCArray::createWithCapacity(count);
char str[80];
for(int k = 0; k < count; k++)
{
sprintf(str, “sd.png”, name, (k));
CCSpriteFrame frame = cache~~>spriteFrameByName;
animFrames~~>addObject;
}
CCAnimationanimation = CCAnimation::create(animFrames, delay);//<——here
return animation;
}
why?
teilala yos wrote:
CCAnimation animation= animationWithSingleFrames;
>
CCAnimation HelloWorld::animationWithSingleFrames(char name,int count,float delay)
{
CCSpriteFrameCachecache = CCSpriteFrameCache::sharedSpriteFrameCache();
CCArray* animFrames = CCArray::createWithCapacity(count);
char str[80];
for(int k = 0; k < count; k++)
{
sprintf(str, “sd.png”, name, (k));
CCSpriteFrame frame = cache~~>spriteFrameByName;
animFrames~~>addObject;
}
CCAnimationanimation = CCAnimation::create(animFrames, delay);//<——here
return animation;
}
>
>
why?
i know
CCAnimation animation = CCAnimation::create;
change to
CCAnimationanimation = CCAnimation::createWithSpriteFrames(animFrames, delay);