Game Development Reference
In-Depth Information
Reloading the cannon
We need to set
canFire
back to
0
so that the cannon can reload and fire another cannon-
ball. Add an
On destroyed
event to our
cannonBall
sprite, as shown in the following
screenshot:
Create the
On destroyed
event and set
canFire
to
0
by adding in a
System
set value of a
variable.
After that, we need to scroll back to the cannon so that the next cannonball will be fired
from there. To do this, we need to set in a
Scroll to object
event for the
System
, as shown
in the following screenshot: