Game Development Reference
In-Depth Information
Destroying the cannonball on a complete stop
The cannonball just sits on the screen and doesn't move. We should then add some logic to
destroy it after it hits a block. Add a
Compare velocity
event to the
cannonBall
sprite.
The velocity that we are going to compare is
Overall velocity
, and we are going to set
Comparison
to
≤ Less or equal
with value
0.1
. This is shown in the following screen-
shot. The reason we don't want to set the value to zero is that our object may still have a
tiny amount of velocity (for instance, of value 0.00001); but as it has not quite made it to
zero, the event would not be activated.
When the cannonball almost comes to a complete stop, we want to destroy it. Add a
Des-
troy object
action to the event, as shown in the following screenshot: