Eduardo Iglesias
Eduardo Iglesias

Reputation: 1066

Cocos2d CCAnimation delay less than .05f problems

I am trying to animate a CCSprite with CCAnimation. I have 100 Frames, but if I run it with a delay of .05f it's too slow. I try to put it .03f and .01f and it didin't complete the animation.

Any idea?

walkAnimFrames has the 100 frames

CCAnimation *walkAnim = [CCAnimation animationWithSpriteFrames:walkAnimFrames delay:0.05f];
            CCRepeat *repeat = [CCRepeat actionWithAction:[CCAnimate actionWithAnimation:walkAnim] times:1];
            [scoreSrpite runAction:repeat];

Or should I use only 50 frames. This is like a scorebar that its filling depending on the actual score

Thanks

Upvotes: 0

Views: 153

Answers (1)

Liolik
Liolik

Reputation: 801

try this method :

[scoreSrpite setDisplayFrame:[walkAnimFrames objectAtIndex:0]];
CCAnimation *walkAnim = [CCAnimation animationWithSpriteFrames:walkAnimFrames delay:0.05f];
CCRepeat *repeat = [CCRepeat actionWithAction:[CCAnimate actionWithAnimation:walkAnim] times:1];
[scoreSrpite runAction:repeat];

Upvotes: 1

Related Questions