Game Development Reference
In-Depth Information
Winning the game
Add two global variables. Name one variable
goalBallCount
and the other one
can-
nonballCount
. These variables will keep track of the number of
goalBall
and
can-
nonBall
sprites on the screen, as shown in the following screenshot:
Add an
On created
event to
goalBall
and make an
Add 1 to goalBallCount
action, as
shown in the following screenshot:
Then, for each
On collision with goalBall
event for our
goalBall
sprites, navigate to
System
and add
Subtract 1 from goalBallCount
. This is shown in the following screen-
shot:
Add an
On created
event to
cannonBall
, and navigate to
System
to add an
Add 1 to
cannonBallCount
action.