motorollin
Member
- Joined
- Jul 31, 2007
- Messages
- 163
I need to code some AI for one of my enemies so that it moves towards the player but moves to avoid bullets. Here's what I'm thinking:
1. Iterate through vector "bullets" to find closest bullet
2. Use the velocities and co-ordinates to predict a collision
3. No collision predicted -> Move towards player and return
4. Collision predicted
5. Search 90, 180, 270 and 360 degrees relative to the bullet's trajectory for other bullets or edge of playfield
6. No safe path detected -> Give up. Move towards player even if bullet in the way, and return
7. Safe path detected -> Move towards safe path and return
Any thoughts on this? Is there a more efficient method?
1. Iterate through vector "bullets" to find closest bullet
2. Use the velocities and co-ordinates to predict a collision
3. No collision predicted -> Move towards player and return
4. Collision predicted
5. Search 90, 180, 270 and 360 degrees relative to the bullet's trajectory for other bullets or edge of playfield
6. No safe path detected -> Give up. Move towards player even if bullet in the way, and return
7. Safe path detected -> Move towards safe path and return
Any thoughts on this? Is there a more efficient method?