Damaging and killing enemies

Now that we have enemies moving towards us, we need some way for them to be damaged and killed! Let's do that now by performing the following steps:

  1. The first thing we need to do is make it easy to get a reference to all of our enemies, so let's add a tag by going to the Inspector tab and navigating to Tag | Add Tag…. Once the Tag & Layer menus come up, type in Enemy into Element 0. Then go back into the Ghost_mesh child object, add the Enemy tag to it, and rename the parent object to Ghost:
    Damaging and killing enemies
  2. Next, let's dive back into MonoDevelop, edit our PhoneBehaviour script, and add the following code in bold to its Update function: ...

Get Unity Game Development Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.