Borgi, I tried your formula like this:
mouseX = enemyUnit.X + cos(random(360)) * random(100)
mouseY = enemyUnit.Y + cos(random(360)) * random(100)
Then move towards the location like this:
set x = lerp(enemyUnit.X, enemyUnit.mouseX, 1 - 0.5 ^ dt)
set y = lerp(enemyUnit.Y, enemyUnit.mouseY, 1 - 0.5 ^ dt)
The problem is the each turn the unit seems to move less and less distance, and usually in the same direction. Is there something that would trip this method up? Should I be setting mouseX and mouseY to zero at the end of each turn.
The game goes player turn move up to 100 px if there is a target in site, fire up to 120px. Same for the enemy unit.
I know this isn't goo ai at all, but I'm just learning some basic concepts. Knowing how to move set pixels in a random direction is good . I also have to study math.
I'm gonna check out RamPack's capx now. That seems like a simple and interesting method..