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 pathfinding algorithm.
Note
In more complex implementations, waypoints can be connected in different ways and these connections can also be created automatically by letting the waypoints find each other. Furthermore, they can also contain other...