Tutorial:An introduction to Game Maker/Actions/Score Actions

From GMWiki, the Gamemaker Wiki.

Jump to: navigation, search

In most games the player will have a certain score. Also many games give the player a number of lives. Finally, often the player has a certain health. The following actions make it easy to deal with the score, lives, and health of the player.

[edit] Image:Action_score.png Set the score

Game Maker has a built-in score mechanisim. The score is normally displayed in the window caption. You can use this action to change the score. You simply provide the new value for the score. Often you want to add something to the score. In this case don't forget to check the Relative box.

[edit] Image:action_ifscore.png If score has a value

With this question action you can check whether the score has reached a particular value. You indicate the value and whether the score should be equal to that value, smaller, or larger.

[edit] Image:action_drawscore.png Draw the value of score

With this action you can draw the value of the score at a particular position on the screen. You provide the positions and the caption that must be placed in front of the score. The score is drawn in the current font. This action can only be used in the drawing event of an object.

[edit] Image:action_highscore.png Display the highscore table

For each game the top ten scores are maintained. This action displays the highscore list. If the current score is among the top ten, the new score is inserted and the player can type his or her name. You can indicate what background image to use, whether the window should have a border, what color for the new entry and the other entries must be, and which font to use.

[edit] Image:action_highscoreclear.png Clear the highscore table

This action clears the highscore table.

[edit] Image:action_lives.png Set the number of lives

Game Maker also has a built-in lives system. With this action you can change the number of lives left. Normally you set it to some value like 3 at the beginning of the game and then decrease or increase the number depending on what happens. Don't forget to check the Relative box if you want to add or subtract from the number of lives. At the moment the number of lives becomes 0 (or smaller than 0) a "no more lives" event is generated.

[edit] Image:action_iflives.png If lives is a value

With this question action you can check whether the number of lives has reached a particular value. You indicate the value and whether the number of lives should be equal to that value, smaller, or larger.

[edit] Image:action_drawlives.png Draw the number of lives

With this action you can draw the number of lives at a particular position on the screen. You provide the positions and the caption that must be placed in front of the number of lives. The number of lives is drawn in the current font. This action can only be used in the drawing event of an object.

[edit] Image:action_drawlivesimage.png Draw the lives as image

Rather than drawing the number of lives left as a number, it is often nicer to use a number of small images for this. This action does precisely that. You specify the position and the image and at the indicated position the number of lives is drawn as images. This action can only be used in the drawing event of an object.

[edit] Image:action_health.png Set the health

Game Maker has a built-in health mechanisim. You can use this action to change the health. A value of 100 is considered full health and 0 is no health at all. You simply provide the new value for the health. Often you want to subtract something from the health. In this case dont' forget to check the Relative box. When the health becomes smaller or equal to 0 an out of health event is generated. mwahahahahahahahaha

[edit] image:action_ifhealth.png If health is a value

With this question action you can check whether the health has reached a particular value. You indicate the value and whether the health should be equal to that value, smaller, or larger.

[edit] Image:action_drawhealth.png Draw the health bar

With this action you can draw the health in the form of a health bar. When the health is 100 the full bar is drawn. When it is 0 the bar is empty. You indicate the position and size of the health bar and the color of the bar and background.

===image:action_caption.png Likz, yar!!

Back to Control Actions | Up to Tutorial:An introduction to Game Maker/Actions | Next to Draw Actions

Personal tools