|
• my solution
I don't know if there is an actual algorithm, but I designed a quick algorithm that probably would work.
the enemy doesn't move until the bullet(s) is within a certain radius of it. Then it assesses the slope of the bullet travelling, and goes the direction away from the bullet, while travelling, continue to check for the radius around it. The bullets closer have greater priority to escape unless there are more bullets on the side it is escaping to. Always, check within the range of the enemy.
I'm not sure how well this would work when there's a large number of bullets, but it should work. Try tweaking the radius size to see if there is an optimal range.
|