CHAPTER 7

image

Intelligent Unit Movement

In the previous chapter, we built a framework for animating and drawing entities within our game and then added different types of buildings, vehicles, aircraft, and terrain to it. Finally, we added the ability to select these entities.

In this chapter, we will add a framework to give selected units commands and to get the entities to follow orders. We will then implement the most basic of these orders: unit movement by using a combination of pathfinding and steering algorithms to move our units intelligently.

Now let’s get started. We will use the code from Chapter 6 as a starting point.

Commanding Units

Get Pro HTML5 Games 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.