If you tried playing the ‘Catch a Clown’ game with ‘identical but different’ clowns, customised during the Editing a Sprite activity, you may have found that you introduced some additional, arbitrary rules of your own to make the game more exciting. For example, you might have decided to only click on the normal clown, and ‘punish’ yourself (with a ‘doh!’) each time you clicked on the ‘bad’ clown.
One of the key things about computer games is they can be designed to enforce these “arbitrary rules” through the software coded architecture of the game. In this customisation howto, I’ll show you how to bring scoring rather more to the foreground in a Game Maker game.
The main reason why we’d want to do this is to keep your players engaged with the game by providing them with a real time report on how well they are doing as measured by their score: remember, we add 10 to the score for each ‘good’ clown that is caught, and lose 10 points for every bad clown that is caught.
By default, the running score is displayed in the title bar of the game window (if you are playing it in a window, rather than in full screen mode).
Displaying the score
To display the score in Catch the Clown, we need to add a score reporting object.
In the nomenclature of Game Maker, this sort of object is referred to as a controller object.
Open up Game Maker, and load in your Catch the Clown game (or whatever variant you’re working on!), and create a new object called
controller_score. We are not going to use a sprite with this object, although it will be “drawing” the score to the screen as you catch the clowns.
In the score controller object, we want to use the “Draw phase” to write the current score onto the screen.
Click on “Add event” in the controller_score Object Properties dialogue, and add a Draw event.
From the Score actions tab, select the Draw Score action. We can keep the label (“Score:”) as it is.
To begin with, lets place the score result somewhere in the middle of the screen – set the x and y positions each to 200 or so. (How can you find out the size of the room? ;-)
To change the font color, in the
controller_score object properties, add a ‘Set Color’ action *before* the Draw Score action in the list of Draw actions. (You can find the ‘Set Color’ action in the Settings area of the draw tab.)
The score controller object now needs to be added to the main room. In the main room properties dialogue, click in the objects panel, select the controller_score object, and then click to place it anywhere within the room (the actual place where the score is displayed is determined by the x and y settings in the Display Score action).
A question mark will appear to show that an object without a sprite has been placed in the room.
If you now run the game, you should see that a current record of your score is displayed as you play the game. Every time you click on a ‘good’ clown, the score should go up by 10 points… but what happens when you click on the bad clown?
To make the score go down by 10 points to penalise the player for clicking on the wrong clown, you need to change the Score action in the badclown object:
Save your game, and play a couple of rounds with it.
Does treating the good and bad clowns differently affect the way you played the game? To what extent did seeing the score within the borders of the game affect your engagement with it, and the desire to replay it?