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

Chapter 10. Attack and Defense

Now that you have completed the player and computer movement, you are ready to begin on attack and defense. In this chapter you will learn how to implement a battle engine in your war games.

In this chapter you will learn how to implement an attack and defense phase between the movement sections of your game. After the player moves and is able to attack, the computer-controlled player will move its units and enter into its attack phase. This means you will have two separate attack engines running, one for the player and another for the computer. From a logical programming point of view, having these two separate phases is easier to work with than trying to get a single engine to control both player and computer ...

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