What if the player wants to reset their high score to zero? We can do this by adding a button in the main menu and resetting the value of the key to zero.
MainMenuScene.swift file, and in the
didMoveToView function where we created the play button, create one more SKSpriteNode called
resetBtn. Place this button at three-fourth of the width of the screen and name the sprite
resetBtn. We will use the name to check whether the player clicked the play button or the reset button.
The assets for the reset button are in the
Resources folder, so create a new image set called
resetBtn and drag-and-drop
resetBtn2.png to the 1x and 2x placeholders, respectively, as shown in the following:
let resetBtn ...