1
override func didMove(to view: SKView)
{
    let blankScoreLabel = "SCORE: "
    scoreLabel.fontSize = 45
    scoreLabel.text = blankScoreLabel
    scoreLabel.position = CGPoint(x: 2, y: 2)
    scoreLabel.color = UIColor.red
    self.addChild(scoreLabel)
}

This is inside the subclass of SKScene. For some reason this SKLabelNode will not show up in my view. Can someone help. If someone could also help me initialize the node in a .sks file that would be helpful as well

Tim2799
  • 71
  • 1
  • 1
  • 10
  • try adding scoreLabel.zPosition = 1. all items need zPositions set, or you need to set `view.ignores>SiblingOrder = false` in the GameViewController (not recommended) – Ron Myschuk Jun 13 '17 at 04:28
  • Try changing the position to CGPoint(x: 200, y: 200) and let me know if and where it appears. If you were trying to place the label in the bottom left, then I think I know where the problem may be. – JohnV Jun 13 '17 at 04:31
  • If I would have to guess, I would say this code is not even being called at all, You are most likely not creating your scene correctly, and it is not point to this custom class. As for initializing the node in a .sks, just create a new game project. The default sks has a Hello World label that you can play with to help you understand what you are trying to do. – Knight0fDragon Jun 13 '17 at 13:40

1 Answers1

1

Ya if you put the label on your sks file you simply put

self.label = self.childNode(withName: "ScoreLabel") as? SKLabelNode

and at the top of your class you put

var labelName: SKLabelNode?
Tim2799
  • 71
  • 1
  • 1
  • 10