Game Development Reference
In-Depth Information
Click on the
On any click
mouse event and press
C
to add another condition. Navigate to
System
|
Compare variable
. Set the
canFire
variable to be equal to
0
(using the
Equal
to
condition). This is shown in the following screenshot:
Once you've done that, add a
System
action to the
On any click
mouse event that sets
canFire
to be equal to 1. This will make the cannon fire only one at a time. If you run
the game now, you will only be able to fire one cannonball. We will add the "reloading"
functionality in a moment. The event sheet should look like the following screenshot:
Setting the viewpoint to follow the cannonball
You will notice that the viewpoint or camera does not follow the cannonball. Double-click
on the cannonball and add a
ScrollTo
behavior, as shown in the following screenshot: