Adding a scoring or points system in a game makes it more interesting and fun to play. Having a scoring system in the game makes it easier for the players to measure their performance, making the objective clear for the user.
It always makes sense to display the score somewhere on the main screen, so that the player can have a look at the score while playing the game.
In the first step of adding a scoring system in our game, we create a label node to display the score to the player. The initial variable will be zero.
Let's add the following code snippet in the beginning of the
let scoreText = SKLabelNode(fontNamed: "Chalkduster") var score ...