April 2021
Beginner to intermediate
506 pages
11h 57m
English
To give monsters some autonomy, you’ll use a combination of agents, goals, and behaviors. Consider the agent as the brains behind the entity, and the goals and behaviors as the driving forces behind its decision making.
You can create an agent for 2D space using the GKAgent2D class. Because this class is a subclass of the GKComponent class, you can use a component system to handle its updates. Using a component system works well when you have lots of entities or for games with complex object graphs (which you’ll add in Using the Navigation Graph Editor). In doing so, you guarantee that all of the entities using this component will get updated at the same time, so let’s get one added.
Read now
Unlock full access