I'm having some issues. I don't know if it is me or the computer, but here is my problem.
my code:
destX = (dx * .05) + (r.nextDouble() * (dx * .9)); // choose random destination
destY = (dy * .05) + (r.nextDouble() * (dy * .9));
This is suppoessed to keep my units away from the edge of the battle screen, unforntally it doesn't seem to work. I have tired several different numeric value, but i can't seem to fix the issue. I have thought about hard codeing number values in, but that is a bad idea if you change the area size. I beleive the area size is roughly 50 x 50. Any ideas?
Edge running
you have a good idea, you just need to make your distance from the edge greater, as 0.05 * boardsize is probably too small. (remember, a small amount of randomness is applied to all movement orders, and this will probably negate your edge avoidance.) something like alphie suggested will work fine, and is probably better because it will keep about a range away from the edge no matter the board size.
adum
adum