Int into label SpriteKit SKView, hl

33 views Asked by At

I just want to know if is it possible to make a label or anything else who will be a integer and to display it to my gameview.

var pvElf = SKLabelNode(fontNamed:"Chalkduster")
pvElf.text = "100";
pvElf.fontSize = 45;
pvElf.position = CGPoint(x:370, y:600)
pvElf.zPosition = 2
addChild(pvElf)

I want pvElf to be an int but I don't find an SKIntNode or anything else. Because I want to decrease this number when I do an action. But if this is a label I can't. Thank you very much !

1

There are 1 answers

1
rmaddy On BEST ANSWER

Simply update the label's text with the Int (converted to a String).

let someInt = 4
pvElf.text = "\(someInt)"