Game Development Reference
In-Depth Information
Losing the game
Add another textbox, make the text say
"Game Over"
, and change the text size so that
it's nice and prominent. Place the textbox somewhere prominent and make note of its posi-
tion.
Then, we need to add a
Compare variable
event that should compare the variable
ball-
sLeft
to be
≤ Less than or equal
to
0
. Then, set the position of the
Game Over
text ob-
ject to the position of the text object noted before.
Make another global variable named
isPlaying
, as shown in the following screenshot:
Add an action that sets
isPlaying
to
1
when the
ballsLeft
variable count is equal or
less than zero. Then, add a condition (by pressing
C
) to the
On any click
mouse event. The
condition is to see whether
isPlaying
is equal to
0
.