Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. var timeAnimation = 2;
  2. var coinsLabel:SKLabelNode = SKLabelNode(text: "0");
  3. var gainCoin = 400;
  4. var currentCoin = 20;
  5.  
  6. func addCoin(coinTotal:Int)
  7. {
  8. currentCoin = coinTotal+currentCoin;
  9.  
  10. self.runAction(SKAction.customActionWithDuration(timeAnimation, updateLabel));
  11.  
  12. func updateLabel(node:SKNode!, t:CGFloat) -> Void{
  13. let coinToAdd = currentCoin*(t/timeAnimation);
  14. coinsLabel.text = ""+Int(coinToAdd);
  15. }
  16. }
  17.  
  18. override func update(currentTime: NSTimeInterval)
  19. {
  20. if i <= score
  21. {
  22. scoreText.text = "Score (i)"
  23. i++
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement