Book Image

Construct 2 Game Development by Example

By : John Bura
Book Image

Construct 2 Game Development by Example

By: John Bura

Overview of this book

Table of Contents (16 chapters)
Construct 2 Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Where to Go from Here
Index

Adding the blocks


Now, we need to add blocks to the game. Click on the block sprite and add a Physics behavior.

Put the block in front of the cannonball and test it out by firing the cannon! This is shown in the following screenshot:

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 screenshot. 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 Destroy object action to the event, as shown in the following screenshot...