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

Basic Player Combat Example

In this section of the book, we are going to implement basic combat for the player. For the moment, we will not consider combat for the computer. In the following example, we will have two units on screen next to each other, and we will use a key press to initiate combat. This is a simple starting point of the combat engine so that you can understand how the basics work before implementing the engine in a more complex game.

Pre-Configured Items

In the following example file, we have already created a number of items ready for programming. We have a new button called Btn_Combat, which is used to initiate combat between the two units closest to each other. We have also placed a computer controlled unit right next to ...

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