时间栏消失从cocos2d v1迁移到v2(kCCProgressTimerTypeBar)
我遇到了时间条问题。直到我使用的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
但没有......定时器的推移,只是这个酒吧是隐藏..
解决:这个问题是一个错误的命名精灵:
的正确的代码是:
barra = [CCSprite spriteWithFile:@"barra.png"];
试试这个:
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]];
ehi谢谢你的回答!但是什么类型的文件是FRAME_BUCKET_FILL?问题不在精灵中,只是为什么如果我删除了所有完美的动作! – TheInterestedOne 2013-02-26 20:39:05
尝试99%的CCprogressTo行动,是显示? – Guru 2013-02-27 05:15:36
我记得CCPrigresstimer的功能减少了2.0。尝试使用不同类型的定时器动画。 – LearnCocos2D 2013-02-25 22:00:54
事实上,我使用这种类型,而不是旧的'kCCProgressTimerTypeHorizontalBarLR'..这应该工作! – TheInterestedOne 2013-02-25 22:07:52