Note that there are some explanatory texts on larger screens.

plurals
  1. POCoco2d animation delay for first time
    primarykey
    data
    text
    <p>In coco2d - When i have animate the first time there is a small delay,but animate in second time,it will works perfect(no delay),How to overcome this problem</p> <p>my code is below </p> <p>-(void)animateImages:(NSString <em>)animationName startImageName:(NSString</em>)sImage individualImageName:(NSString *)imgName withDelay:(CGFloat)delay startFrame:(NSInteger)sFrame endFrame:(NSInteger)eFrame { isAnimating=YES;</p> <pre><code>[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:[NSString stringWithFormat:@"%@.plist",animationName]]; CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:[NSString stringWithFormat:@"%@.png",animationName]]; [self addChild:spriteSheet z:0]; // Load up the frames of our animation NSMutableArray *walkAnimFrames = [NSMutableArray array]; for(int i = sFrame; i &lt;= eFrame; i=i+2) { [walkAnimFrames addObject:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"%@ %d.jpg",imgName,i]]];//@"stand march %d.jpg" } NSLog(@"After NSMutableArray"); CCAnimation *walkAnim = [CCAnimation animationWithFrames:walkAnimFrames delay:delay]; CCAction *standByAtion =[CCSequence actions: [CCRepeat actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO] times:1],[CCCallFunc actionWithTarget:self selector:@selector(setAnimatingToFalseAfterAnimation:)],nil]; [walkAnimFrames removeAllObjects]; walkAnimFrames=nil; CGSize winSize = [[CCDirector sharedDirector] winSize]; CCSprite *images = [CCSprite spriteWithSpriteFrameName:[NSString stringWithFormat:@"%@",sImage]];//@"stand march 101.jpg" images.position=ccp(winSize.width/2,winSize.height/2); images.scaleX=1.6; images.scaleY=1.59; [spriteSheet addChild:images]; [images runAction:standByAtion]; NSString *audioName=[NSString stringWithFormat:@"Jump.caf"]; [self playSoundEffectNamed:audioName]; </code></pre> <p>}</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload