I'm setting a label
let scoreLabel = SKLabelNode(fontNamed: "Edit Undo Line BRK")
in a function
func increaseScoreBy(increment: Int) {
score += increment
scoreLabel.text = "Score: 100"
scoreLabel.removeAllActions()
scoreLabel.runAction(scoreFlashAction)
}
and if I comment out the scoreLabel.text = "Score: 100" then it will run perfectly but the score obviously won't update. originally I had it \(score) but I changed it to static text to see if that was the issue. any ideas on why this would act like this?
there is one thing, if its \(score) instead of 100 it will pause (temporarily freeze) the game every time the score updates, if its hard coded, it only freezes the first time.
update
Initialization of the scoreLabel in the game setup
scoreLabel.fontsize = 50
scoreLabel.text = "Score: 0"
scoreLabel.name = "scoreLabel"
scoreLabel.verticalAlignmentMode = .Center
scoreLabel.position = CGPoint( x: size.width / 2, y: size.height - scoreLabel.frame.size.height + 3)
hudLayerNode.addChild(scoreLabel)
scoreFlashAction = SKAction.sequence([SKAction.scaleTo(1.5, duration: 0.1), SKAction.scleTo(1.0, duration: 0.1)])
scoreLabel.runAction(SKAction.repeatAction(scoreFlashAction, count: 20))
update
It is definitely the font type some how. I removed the fontName and just made a regular label and no issues, but of course the font is wrong.