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 ...
19. Wandering Hazards
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.