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

Multiple Unit Movement

Creating movement for a single unit is straightforward, but in all computer war games the player will be looking after anything from half a dozen units to maybe 50 or even 100. The problem then exists how you handle movement for so many units. Even though the code to make one unit move is basically the same as moving a second unit, some additional code is needed to keep track of which unit is currently being moved. Most of the code is repetition of code you have already used, and as you become more experienced in MMF2, you will be able to copy and paste sections of code between tasks, and this will speed up the overall coding time.

In this section of the chapter, you will be moving two units on a hexagon map, so you need: ...

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