我正在使用此代码添加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];
最佳答案
添加:
self.progressTimer.barChangeRate = ccp(1,0);
CCProgressTo *to1 = [CCProgressTo actionWithDuration:0.2f percent:100];
[self.progressTimer runAction:to1];