Dealing with the life and death of the player
As this is a game about survival, we will want the win/lose condition to be fairly simple. For the win condition, we will make the player survive for a set amount of time. The lose condition will be the player dying, but we don't want to come across as too hard to play, so we will give the player three lives. This means that we are going to need to respawn the player. Finally, to get this to work properly, we will need to give the Overlord some more duties.
Setting up the win condition
The win condition for this game is to survive for a set amount of time. We can achieve this through the use of an alarm and a variable to signal to the Overlord that the player has survived.
We will need to set up some variables for the lives, win, and lose conditions. Reopen
scr_Overlord_Create
and add the following code at the bottom:lives = 3; isVictory = false; isDefeat = false;
GameMaker: Studio has a few built-in global variables including
lives
. This variable...