0

I'm making a game and I have a function that calculates the score and displays it on the screen. When the game ends it transitions into a new scene, (game over screen). I was wondering what method I can use to display my score on the second scene after it transitions. My code is:

var score = 0
var scoreLabel = SKLabelNode()

func updateScore() {

    score++
    scoreLabel.text = String(score)
}
NickyNick321
  • 213
  • 1
  • 4
  • 12
  • 1
    Look at this previous Q&A. Principal is the same. http://stackoverflow.com/questions/30878572/passing-info-from-collectionview-to-gamescene – sangony Jun 17 '15 at 14:35

1 Answers1

1

When initializing the scene that you are going to change to, you can pass the value. You will need to make an int for the score in the next scene, and can say nextScene.score = score

Seth Rodgers
  • 69
  • 1
  • 7