Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var timeAnimation = 2;
- var coinsLabel:SKLabelNode = SKLabelNode(text: "0");
- var gainCoin = 400;
- var currentCoin = 20;
- func addCoin(coinTotal:Int)
- {
- currentCoin = coinTotal+currentCoin;
- self.runAction(SKAction.customActionWithDuration(timeAnimation, updateLabel));
- func updateLabel(node:SKNode!, t:CGFloat) -> Void{
- let coinToAdd = currentCoin*(t/timeAnimation);
- coinsLabel.text = ""+Int(coinToAdd);
- }
- }
- override func update(currentTime: NSTimeInterval)
- {
- if i <= score
- {
- scoreText.text = "Score (i)"
- i++
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement