Creating Your Second Enemy

We did say that we could put that FlightPoints script on anything we want, right? Well, we’ve actually made for ourselves a relatively easy way to add a flying enemy type that moves on a two-point patrol, so let’s go ahead and do that too!

We’ll create a Fly that moves between two points and deals damage to the player if it comes into contact with them. We’ll also make some minor adjustments to the Flight-Points script so that our Fly faces the correct way while it travels.

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation 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.