Kraven
Kraven

Reputation: 247

Int into label SpriteKit SKView, hl

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 !

Upvotes: 3

Views: 33

Answers (1)

rmaddy
rmaddy

Reputation: 318804

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

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

Upvotes: 4

Related Questions