0
我想延迟添加到一个精灵,所以当我进入一个新的场景它不打直线距离,任何建议将不胜感激感谢时间延迟,cocos2d的
继承人的精灵的代码,如果有帮助
//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];
//-----------------------------------------
尝试搜索'NSTimer'。我确定有一些关于使用它的教程。 – evotopid 2012-01-07 09:37:20