0

How can I make the animating sprite smaller as my images are very larger. I tried bird->setScale(0.5f); but I it didn't decrease the scale. following is my code to animate the sprite.

int numframe = 3;
CCArray* frames = CCArray::createWithCapacity(numframe);

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("bird-anim.plist");
CCSpriteFrameCache* frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();


char file[100] = {0};
for (int i = 0; i < numframe; i++)
{
    sprintf(file, "bird-anim%d.png", i+1);
    CCSpriteFrame* frame = frameCache->spriteFrameByName(file);
    frames->addObject(frame);
}

CCAnimation* animation = CCAnimation::createWithSpriteFrames(frames, 0.1);
CCAnimate* animate = CCAnimate::create(animation);
CCRepeatForever* repeat = CCRepeatForever::create(animate);

bird->runAction(repeat);
bird->setScale(0.7); 

0 Answers0