2013-02-25 75 views
0

我遇到了時間條問題。直到我使用的cocos2d v1都正常工作。當我更新到v2時,我的酒吧消失了!這是CCProgressTimer的問題,因爲如果我顯示沒有時間依賴性的精靈,所有工作都正常。所以這不是定位或z的問題。 時間不多了,因爲在代碼中實現一段時間後,遊戲進入遊戲過程。問題在於該視圖中沒有顯示該欄。時間欄消失從cocos2d v1遷移到v2(kCCProgressTimerTypeBar)

這是在init函數的代碼:

remainingTime = MaxTime; 
    bar = [CCSprite spriteWithFile:@"barra.png"]; 
    bar = [CCProgressTimer progressWithSprite:barra]; 
    bar.type = kCCProgressTimerTypeBar; 
    [bar setPosition:ccp(50 , size.height - 18)]; 
    [bar setPercentage:100]; 
    [self addChild:bar]; 
    NSLog(@"bar added! Here: %f %f", bar.position.x, bar.position.y); 

我試圖把z:10000但沒有......定時器的推移,只是這個酒吧是隱藏..

+0

我記得CCPrigresstimer的功能減少了2.0。嘗試使用不同類型的定時器動畫。 – LearnCocos2D 2013-02-25 22:00:54

+0

事實上,我使用這種類型,而不是舊的'kCCProgressTimerTypeHorizo​​ntalBarLR'..這應該工作! – TheInterestedOne 2013-02-25 22:07:52

回答

0

解決:這個問題是一個錯誤的命名精靈:

的正確的代碼是:

barra = [CCSprite spriteWithFile:@"barra.png"]; 
0

試試這個:

mBarProgress = [CCProgressTimer progressWithSprite:[CCSprite spriteWithFile:@"barra.png"]]; 
    mBarProgress.position = ccp(50.0f*(mS.width/480.0f), 706.0f*(mS.height/768.0f)); 
    mBarProgress.midpoint = ccp(0.0f,1.0f); 
    mBarProgress.barChangeRate = ccp(1,0); 
    mBarProgress.type = kCCProgressTimerTypeBar; 

    [self addChild:mBarProgress z:4]; 

    [mBarProgress runAction:[CCProgressTo actionWithDuration:1.0f percent:99.0f]]; 
+0

ehi謝謝你的回答!但是什麼類型的文件是FRAME_BUCKET_FILL?問題不在精靈中,只是爲什麼如果我刪除了所有完美的動作! – TheInterestedOne 2013-02-26 20:39:05

+0

嘗試99%的CCprogressTo行動,是顯示? – Guru 2013-02-27 05:15:36