I am having a small problem with my selection code.
I had it working awhile back ago so that you could select single units, but you could not select multiple units.
After working on several other features, I decided to come back to my selection code and implement a method would select multiple units instead of just a single unit.
Unfortunately, there is a small problem. I use a selection box, obviosly, to designate which units on the screen I want to select. Unfortunately, no matter where I draw my selection box, ALL units get selected no matter what. This is not good. I also have no clue what is going wrong in my code.
Here is the selection method:
It is such a simple method. It baffles me why it does not work.Code:void Select ( int x1, int y1, int x2, int y2, int playerID ) { if ( x1 > x2 ) swap(x1, x2); if ( y1 > y2 ) swap(y1, y2); if ( playerID == Flag.ALLEGIANCE ) { if ( (WorldX > x1) && (WorldX < x2) && (WorldY > y1) && (WorldY < y2) ) { Flag.SELECTED = true; } else { Flag.SELECTED = false; } } }



LinkBack URL
About LinkBacks


