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

19. Wandering Hazards

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

In this chapter, we’ll implement an obstacle type that is placed within a wander region, which is pretty much an invisible box, and will randomly move to a new point within the region at random times. They’ll look like the Patrollers we implemented in the last chapter, but their movement will be constrained within the wander region they’re associated with. To avoid sudden movement that kills the player in frustrating ways, we’ll make the wanderers turn to point in the direction they’re going to travel next, wait a little, and then move. This gives the player a little time ...

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.