2015-01-15 4 views
0

아래에서 볼 수 있듯이 점수가 올라갈 때마다 내 ScoreLabel의 크기를 늘리는 작업을 실행하려고합니다. 내 앱을 실행할 때 내 레이블의 크기가 원래 형태로 되돌아 가지 않는다는 것을 깨달았습니다. 나는 많은 방법을 시도,하지만 난 당신이 찾고있는 무엇을 할 수있는 다음 줄을 사용하여 빠른 답변점수 레이블 애니메이션에 대한 Sprite Kit 동작

-(void)update:(CFTimeInterval)currentTime{ 
    /* Called before each frame is rendered */ 
    // Update wird vor jeden Frame aufgerufen 


    // Score Counter 
    if([speerArray count] > 1) { 
     SKSpriteNode *sprite = [speerArray objectAtIndex:1]; 
     if (sprite.position.y < superhero.position.y && [sprite.name isEqualToString:@"speer"] && sprite.position.y > 0) { 

      SKAction* scoreAction = [SKAction scaleBy:2 duration:1]; 



      score ++; 
      [scoreLabel runAction:scoreAction]; 


      scoreLabel.text = [NSString stringWithFormat:@"%d", score/2]; 




      sprite.name = @"afterBird"; 
     } 

    } 
+0

"원래 형태"란 무엇을 의미하며 되돌릴 것으로 생각되는 부분은 무엇입니까? – sangony

+0

레이블의 크기를 최대 두 배로 조정했지만 결코 다시 축소하지 마십시오. scoreAction 뒤에 시퀀스를 추가하여 0.5만큼 크기를 조정합니다. – Okapi

답변

1

당신을 위해 희망 그것을

실현을 couldnt :

[scoreLabel removeAllActions]; 
SKAction* scoreAction = [SKAction scaleBy:2 duration:1]; 
SKAction* revertAction = [SKAction scaleTo:1 duration:1]; 
SKAction* completeAction = [SKAction sequence:@[scoreAction, revertAction]]; 
[scoreLabel runAction:completeAction]; 

당신은에 넣을 수 있습니다 필요한 경우, waitForDuration: 조치도 취하십시오.