Dealing with one unit or even one unit per team is pretty simple. When you start to have multiple units per team, things start to get hairy. In this lesson, we'll deal with a fixed number of units per team. This code will lay the foundation for lesson where we'll add cities. With cities we'll be able to have an indeterminate number of units per team.
|
This is meant to be a replacement when we do things (javascript menus) that might get hidden behind the applet.
|
Using arrays to track a static number of units: 5 vs 5
Should be able to change the number of units simply by increasing the size of the arrays
Selecting a unit
Feedback
Cycling through all the units in a team with the 'n' key
Adding unit info to output
Add a square around the selected unit to indicate which one's selected