Game Development Reference
In-Depth Information
In the
On destroyed
event of the
cannonBall
sprite, add a
Subtract 1 from can-
nonBallCount
action. This is shown in the following screenshot:
Copy the last two events we made. Add a condition to the
ballsLeft ≤ 0
event by pressing
the
C
key. Add a compare variable event to compare whether
cannonBallCount
is less
than or equal to zero. Once you have done this, copy the event and change
can-
nonBallCount
to
goalBallCount
. This will cause the event to activate if there are no
goalBall
or
cannonBall
sprites left on the screen.
Add a
Set text
action to
textGameOver
; only this time, make it say
You Win!
. Check the
following screenshot: