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

Player Combat All Units

In this section, you will take the next step in creating a combat engine. This next example deals with how to implement combat from any of your player units and how to attack a single enemy unit. This enemy unit can only be on a surrounding hexagon around the attacking player.

This involves a lot more work than the previous example and is certainly more complex. The complexity arises because of the need to pick an enemy object to attack. To choose this enemy object, start thinking about the Pick conditions in MMF2; these will allow you to choose the right enemy unit.

Even though some conditions and actions are still valid from the previous example, you need to change/add a fair bit of code to make the program select a ...

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