Goal:
Let’s write code that will constantly be checking for a new high score.
When the player obtains a score higher than the current high score displayed on the game screen, then we want to replace the that current high score with the new score the player obtained.
Steps:
- Still on the Backdrop sprite, From Events, place a When I receive block and change it to “GameStart“.
- From Control, add a forever loop, then put an IF statement inside it.
- From Operators, add a > (greater than) block inside the IF statement.
- From Variables, add the variable “Score:” on the left side and add the variable “High Score:” on the right side.
- From Variables, place a set to block and change the variable to High Score:.
- From Variables, place a round Score: block to the right side of the set to block.