As well as providing a way of measuring ‘success’ whilst you are playing a game, scores also allow support the element of competition with other players and against your own previous attempts at playing the game. Game Maker provides support for a High Score table that will keep track of the 10 highest scores that have been achieved playing the game.
To display the High Score table at the end of the game, we need to add another event to the
controller_score object (as introduced in Points Make Prizes – or Penalties…) that will detect when the game has ended, and then display the High Score table.
controller_score Object Properties dialogue, click on ‘Add Event’ and then select Other. From the popup menu that appears, select Game End. This event is raised whenever the game ends, such as when you click on escape to stop playing the game. From the score actions tab, select the Show Highscore action and add it to the list of actions that are are executed when the Game End event is raised.
Now when you play the game, you should be able to keep track of your score as you play, and then see whether or not you have managed to make the High Score table at the end of the game!
To increase the element of competition when you start a game, how might you display the high score table at the start of the game using a similar technique to the way you added the High Score table at the end of the game? How satisfactory is this solution likely to be in general?
If you explore the Events option, you will see that as well as the Game End event, there is a Game Start event.
This can be used to display the High Score table at the start of the game in much the same way that the Game End event displayed the table at the end of the game.
Unfortunately, whilst the display of this table at the start does mean you know what score you need to achieve in order to make it into the top 10, the fact that the game has actually started to run *underneath* the high score table may be problematic; for example, if you are playing a game where your player can be attacked and ‘killed’ by monsters before you manage to close the high score display, your experience of the game will not be a good one!
We’ll come on to see how to create a special start screen for the game in a few posts time – but for now, I need to get back to the grind and make that high score table mine… ;-)