2013-01-08 17 views
1

我正在使用此代碼來添加progressTimer。但它沒有在屏幕上顯示。ProgressTimer不能在屏幕上顯示cocos2d iphone

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

補充一點:

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

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

你能解釋一下你在做什麼?僅將更改更改爲X? – TankorSmash

+0

柱線變化率x = 1表示其水平進度條y不變。如果y = 1表示其垂直進度條。 – Guru