-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

GameMaker Cookbook
By :

The term "game" has many different definitions, to the point where experts can't always agree what makes a game. Most definitions, though, determine that games are only such if they involve both win and lose scenarios. I mean, who wants to play a game you can't win or lose?
This recipe, again, does not necessitate new sprites or even objects. We'll be relying on existing objects but we'll be adding some new variables. Start by opening the Object Properties for obj_player
.
lives
equals 0
.obj_player
and open obj_score
.score
is equal to 100
.As you may have guessed by the names of the actions, you are simply asking GameMaker to check the values of score
and lives
, and restarting the game when they reach a certain point. In previous recipes you set the score to increase by 10 whenever you shot an enemy. If you shoot 10 enemies, the game will restart. You set the lives variable to 3
but had it decrease by 1 every time your health reached 0
. Once you have no lives left, the game restarts.
Using Game Restart in this scenario is arbitrary; it is simply there to demonstrate that you can tell GameMaker to change the game's state based on your score, health, or number of lives. Under the Main1 tab in Object Properties you can find actions that take you to other rooms you may have created. This can be used to go from one level to another.
Change the font size
Change margin width
Change background colour