1

我正在使用此代码添加 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];
4

1 回答 1

1

添加这个:

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

CCProgressTo *to1 = [CCProgressTo actionWithDuration:0.2f percent:100];
[self.progressTimer runAction:to1];
于 2013-01-08T16:30:01.740 回答