我想为精灵添加延迟,所以当我进入一个新场景时它不会立即播放,任何建议都会非常感谢
如果有帮助,这里是精灵的代码
//SPRITES BIRD ONE -------------------------
//------------------------------------------
CCSpriteFrameCache *cache=[CCSpriteFrameCache sharedSpriteFrameCache];
[cache addSpriteFramesWithFile:@"house-ipad.plist"];
// frame array
NSMutableArray *framesArray=[NSMutableArray array];
for (int i=1; i<24; i++) {
NSString *frameName=[NSString stringWithFormat:@"house-ipad%d.png", i];
id frameObject=[cache spriteFrameByName:frameName];
[framesArray addObject:frameObject];
}
// animation object
id animObject=[CCAnimation animationWithFrames:framesArray delay:0.035];
// animation action;
id animAction=[CCAnimate actionWithAnimation:animObject restoreOriginalFrame:NO];
//id animAction=[CCAnimate actionWithDuration:4 animation:animObject restoreOriginalFrame:NO];
//animAction=[CCRepeatForever actionWithAction:animAction];
// sprite (width,height)
CCSprite *bird=[CCSprite spriteWithSpriteFrameName:@"house-ipad1.png"];
bird.position=ccp(550,470);
// batchNode
CCSpriteBatchNode *batchNode=[CCSpriteBatchNode batchNodeWithFile:@"house-ipad.png"];
[self addChild:batchNode];
[batchNode addChild:bird];
[bird runAction:animAction];
//-----------------------------------------