Game Development Reference
In-Depth Information
Now all you have to do is create a new rule. When Kevin collides with an enemy,
use
Change Attribute:
game.Health
to:
game.Health
- (whatever value you want
enemies to take off). Now let's add in some lives. To do this, all we have to do is
create a new game-wide attribute (Integer of course), and name it
Lives
. Change the
value to
5
. If you want, you can also have a selection on the main menu to select your
difficulty, and depending on what difficulty you select, you can adjust health and
lives. Then add in your
No Health
, and
Bottom of the Screen
rules before the
Reset Scene
behavior. Add in a Change Attribute behavior and change it to
Change
Attribute:
game.Lives
to:
game.Lives - 1
:
Now you can add in a rule inside the Kevin actor detecting when the
game.Lives
=
0
, have it change the scene to a game over screen. From there, you can have a button
to continue or go back to the main menu. Once one of the buttons has been pressed,
reset the lives back to
5
or the number you chose.
That's all for health, dying, and lives! It's super simple. Now let's talk about scoring,
and continuing our game.