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:

Destroying the enemy

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

Destroying the enemy

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.

Destroying the enemy

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:

Destroying the enemy

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.98.250