Score Actions in GameMaker: Studio

By Michael Rohde

Scoreboard! Yep, that’s right, this tab of GameMaker: Studio is all about keeping score and seeing who’s the winner and who’s the loser. This figure shows the score tab and its associated Actions, which includes score, lives, and health.

The Score tab on GameMaker: Studio.
The Score tab on GameMaker: Studio.

Score actions

Score is considered a global variable within GameMaker and can be used with any Object. The Score Actions, shown in this figure, are the following:

  • Set Score: This Action is used to determine the player’s score. It’s important to toggle Relative within the Set Score Action Properties window — you want the player to keep increasing his score, and not to maintain it (as in, you want the player to earn 10 points for every enemy killed and not just have a consistent score of 10).

  • Test Score: This Action tests to see what the player’s score is, and if it matches a certain value, to trigger the next Action.

  • Draw Score: This Action enables you to draw the player’s score in the game as simple text. All you have to do is configure the correct location within the Room.

  • Clear Highscore: This Action does exactly as its name implies: clears the high score table, if you have one set up. You should be warned though, that the Clear Highscore Action cannot be undone.

    Score Actions from the Score tab.
    Score Actions from the Score tab.

Lives actions

Here are the Lives Actions (see the next figure):

  • Set Lives: This Action determines how many lives the player has before it’s game over. Lives is considered a GameMaker global variable.

  • Test Lives: This Action enables you to, for example, set a maximum number of lives that the player can have, or a minimum number, if that’s what you need for your game.

  • Draw Lives: This Action draws the score based on the coordinates that you input. You must place this Action within a Draw Event for it to work.

  • Draw Life Images: This Action is awesome for those times when you want to represent the number of player’s lives through an image instead of text or a number.

    Lives Actions from the Score tab.
    Lives Actions from the Score tab.

Health actions

The Health Actions, shown in the next figure, are similar to the Lives Actions — you have Set Health, Test Health, Draw Health, plus the additional Score Caption Action. Health is a global variable within GameMaker with a range of 0% to 100%. When a player’s health reaches 0, an out-of-health Event is triggered.

  • Set Health: This Action is used to set the amount of health a player has.

  • Test Health: This Action can be fun to use — for example, if you want to warn the player that his health has fallen below a certain threshold, then the following Action is triggered.

  • Draw Health: This Action is used to create a bar of health to indicate the strength of the player. You can set the position, size, and color of the health bar.

  • Score Caption: This Action enables you to configure whether to display the score, lives, and health, including the caption for each. The Score Caption Action only works with Windows, Ubuntu (Linux), and MacOS targets.

    Health Actions from the Score tab.
    Health Actions from the Score tab.