Waypoints for enemies
A waypoint is a special point on the map where NPCs change their direction to move towards another waypoint. They can contain logic to actually lead the character to specific places that change over time, such as next to the player. For instance, in a shooting game, enemies want to get closer to the player to shoot him/her. Waypoints can also perform part of the decision-making process. For example, imagine a tower defense level where the path of the enemies splits in two. In this case, the waypoints can be used to decide which direction a particular enemy should take (we will see this in the last chapter of this book). The advantages of waypoints are that, in some cases, they can be more efficient than implementing a complete ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access