여기 내 코드는 둥근 CCProgressTimers (시계 모양)에 사용됩니다. 배경 스프라이트와 배경 스프라이트 위에 "이동 가능"스프라이트가 필요할 수 있습니다.
CCSprite *movableSprite = [CCSprite spriteWithFile:@"health100.png"];
CCProgressTimer *healthBar = [CCProgressTimer progressWithSprite:movableSprite];
healthBar.type = kCCProgressTimerTypeRadial; // This is for round progress timer. Possible value for horizontal bar will be kCCProgressTimerTypeHorizontalBarLR
healthBar.midpoint = ccp(0,0.5); // Here is where all magic is
healthBar.barChangeRate = ccp(1, 0); // If you need horizontal bar progress play with these parameters.
// Here we will start an animation process.
// You can do it without animation just setting up healthBar.progress = 45.0f; (45%)
[healthBar runAction:[CCProgressFromTo actionWithDuration:2.0f from:0.0f to:100.0f]];
healthBar.position = ccp(100, 100); // It's your position
[self addChild:healthBar];
플레이어가 이기면 진도 표시 줄에 다른 스프라이트를 추가하면됩니다. ccprogresstimer 필요가 없습니다. 또는 배열로 밀고, 당신이이기는 때마다, progressbar는 배열 카운트를 검사합니다. 그런 식으로 얼마나 많은 승리를 거둘 수 있는지 알 수 있습니다. –