© Casey Hardman  2020
C. HardmanGame Programming with Unity and C#https://doi.org/10.1007/978-1-4842-5656-5_18

18. Patrolling Hazards

Casey Hardman1 
(1)
West Palm Beach, FL, USA
 

Now that the game is shaping up more, it’s in need of some greater obstacle variety. In this chapter, we’ll implement “patrollers.”

Patrollers are objects that we set up with a series of points they’ll travel along. They move from one point to the next, starting at the first point and going down the list. Once they reach the last point, they double back to the first point again and then repeat the process. We can set the points up however we want and use however many points we want. If we want an obstacle to travel in a simple line back and forth, we can just use two points: ...

Get Game Programming with Unity and C#: A Complete Beginner’s Guide 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.