进度计时器没有显示在cocos2d iphone的屏幕上

时间:2013-01-08 13:41:39

标签: iphone ios cocos2d-iphone

我正在使用此代码添加progressTimer。但它没有在屏幕上显示。

CCSprite* sprite_HealthBar = [CCSprite spriteWithFile:@"green_health_bar.png"];
        self.progressTimer = [CCProgressTimer  progressWithSprite:sprite_HealthBar];
        self.progressTimer.type = kCCProgressTimerTypeBar;
        self.progressTimer.scale = 5;
        self.progressTimer.percentage = 100;
        self.progressTimer.position =  ccp( winSize.width/2 , winSize.height/2 );
        self.progressTimer.midpoint = ccp(0,0);
        [self addChild:self.progressTimer z:2];

1 个答案:

答案 0 :(得分:1)

添加:

self.progressTimer.barChangeRate = ccp(1,0);

CCProgressTo *to1 = [CCProgressTo actionWithDuration:0.2f percent:100];
[self.progressTimer runAction:to1];