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

Destroying the enemy


Let's add another event. This time, we want to destroy the enemy and the projectile when the projectile hits the enemy. Navigate to Add event | Projectile | On collision with another object, as shown in the following screenshot:

Choose Enemy in the dialog box that pops up, as shown in the following screenshot:

Once you have done that, add an action and choose the projectile. Scroll down until you see Destroy, as shown in the following screenshot. This will destroy the projectile.

Do the exact same thing for the enemy. You have to destroy both the enemy and the projectile. The event sheet should look like this at the end:

Test out the game and see how it works. When you run the game, you should see that the enemy moves towards the player. When the projectile hits the enemy, the enemy and the projectile should be destroyed.