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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.