如果我的图像非常大,我怎样才能使动画精灵更小。我试过bird->setScale(0.5f);
,但我并没有减少比例。
以下是我为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);