Game Development Reference
In-Depth Information
Setting up an HUD cannonball tracker
Next, we'll set up a tracker for our remaining cannonballs. Right-click on our
Score
textbox
and select the
Clone
object type. Change the textbox content to
Balls Left
and add a
global variable named
ballsLeft
, as shown in the following screenshot:
Add another action to the
On destroyed
event for the cannonball and make it a
Subtract
from
action. We want to subtract
1
from the
ballsLeft
variable so that the count de-
creases as each cannonball is fired and destroyed. This is shown in the following screen-
shot:
Set the value for the cannonball tracking box to
"Balls Left: "&BallsLeft
so that
it will automatically update in the same way as the score tracker.
Your
Every tick
event should therefore look like the following screenshot: