How to solve the delay problem in animation of sprites ?
Posted
by srikanth rongali
on Stack Overflow
See other posts from Stack Overflow
or by srikanth rongali
Published on 2010-03-18T13:59:22Z
Indexed on
2010/03/18
14:01 UTC
Read the original article
Hit count: 274
My problem is, I did coding for a sprite. It should change it should change it's image from( 1, 2, 3). It should look like count down time to start a game. 1, 2, 3 are 3 png images. But the images are not displayed in equal intervals of time. I mean time between (1 - 2), (2 - 3) is not same. It is random. Please help me with my problem. Help me if there is better solution than what I am doing.(My animation should be like, before any game starts we see count down 1 then 2 then 3 then GO).
-(id)init { if((self = [super init])) { [[CCDirector sharedDirector] setAnimationInterval:60.0/60]; [[CCDirector sharedDirector] setDisplayFPS:NO];
CCAnimation* numberAnimation = [CCAnimation animationWithName:@"countDown" delay: 60.0/60];
for( int i=1;i<4;i++)
[numberAnimation addFrameWithFilename: [NSString stringWithFormat:@"number_%02d.png", i]];
id numberAction = [CCAnimate actionWithAnimation: numberAnimation restoreOriginalFrame:NO];
id action2 = [CCFadeOut actionWithDuration:0.5f];
CCSprite *number;
number = [CCSprite spriteWithFile:@"number.png"];
....
} }
© Stack Overflow or respective owner