2010-03-18 61 views
1

我的問題是,我編碼的精靈。它應該改變它應該從(1,2,3)改變它的圖像。它應該看起來像倒計時開始遊戲。 1,2,3是3 png圖像。但圖像不會以相同的時間間隔顯示。我是指(1 - 2),(2 - 3)之間的時間不一樣。這是隨機的。請幫我解決我的問題。如果有比我更好的解決方案,請幫助我(我的動畫應該是這樣的,在任何遊戲開始之前,我們都會看到倒數1,然後是2,然後3倒數)。如何解決動畫中的延遲問題?

- (ID)初始化 { 如果((個體= [超級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"]; 

....

}}

回答

0

你必須更新一些這篇文章對我的團隊的開發人員寫的,因爲它是對的Cocos2D 0.8書面中使用的類。 2,但我認爲這應該爲你做的伎倆......

http://getsetgames.com/2009/08/05/improving-the-performance-of-animating-sprites-in-cocos2d/

從快速看起來你需要做的F ollowing變化......

  • IntervalAction變化CCIntervalAction
  • CocosAnimation變化CCAnimation(我想?)
  • CocosNodeFrames改變CCNodeFrames(我想?)

你必須仔細檢查Cocos2D 0.99 release notes。它詳細介紹了您需要的所有類名。