O'Reilly logo

Going to War: Creating Computer War Games by Jason Darby

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Enemy Movement Example

In this section of the book, you are going to create the first enemy movement that uses the Wargame Map Object rather than using a set path. You will use a simple map with only one enemy unit, which will reduce the overall number of events that you have to program. You will also have three player units on screen that you can move around to test whether the wargame object is recalculating its path to an object each turn.

Before you load up a premade map with the objects already placed on the frame, you may notice that the code is now becoming larger and taking up more space, and it’s becoming harder to read and remember what each bit of code achieves. In your own games, you should definitely consider putting code comments ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required