Stars and the High Score
The game gives you up to three stars for a level: 3 stars for a score of 1000 or more, 2 stars from 600, 1 star from 300, and none for less. It also remembers your best score so far, which is in a new constant, highScore. When your new score is higher, the game celebrates; otherwise, it shows you the high score you have yet to beat.
Add two lines below the score. For this level, the whole output is:
Coins: 370
Enemies: 300
Time bonus: 150
Score: 820
Stars: 2 of 3
High score: 900With highScore = 800, the last line would be New high score! instead. A score that's only equal to the high score isn't a new one.
A tip: with the stars, the order of the conditions matters, as it did with else if in the lesson on conditions.
Instructions
Print how many stars the level gets.
Below that, print New high score! if the score is higher than highScore, and the high score otherwise.
Start programming for free
2/3