So I'm about done with this I think. I keep rewriting this little program and getting stuck around the same spot.
So I want to be able to control multiple units one at a time. If I click a unit they become active, if I click somewhere on the map that is free (using an array to track objects in level) then a little icon will pop up with a couple of options for the units. So far I just want to be able to move to that spot.
So far, this is working really nicely with one unit, but as soon as I introduce a second, I get problems. For a start, if I move the first unit, the second won't move when ordered to, and will only move after the first unit is selected to move somewhere again. Then, if I move the original unit a second time, the first unit zooms off to the top left corner of the page.
I figured there's a problem in the logic somewhere, but it's doing my head in trying to work out why this is happening. I'm telling units only to move if a 'isSelected' boolean is true, but as far as I can tell, the units are ignoring this
I tried creating a global variable that keeps a track of the UID of only the current unit, but even this doesn't seem to work.
Anyway, some fresh eyes on this would be appreciated, I'm probably missing something very basic.