iosswiftsprite-kitskspritenode

How to save and print the high score into the next scene?


Hey guys im looking for some help. I'm new making games and stuff so it's a little difficult for me. Im trying to save the score and print it into my GameOverScene.swift from the GameScene.swift, any advice?


Solution

  • A few options might be:

    1. Save highscore in app delegate. I gameover scene print it from appDelegate.
    2. Save highscore in NSUserDefault. then in GameOverScene show it form there.
    3. Create a property in GameOverScene and while navigating to GameOverSecne from GameScene set that property.

    Here is some tutorial on NSUserDefault, Passing data between ViewControllers.