So: top-down game, my enemies chase the player, when they get within a certain distance they stand still and fire. If they're all coming from the same direction they all end up standing in the same spot (i.e. standing "within" each other), as I'm not currently doing collision detection between enemies - they are free to pass over each other.
What's a simple way around this? Either some form of collision detection or some ai?
Answer
You don't need collision detection, but you will need to give your enemies a bit of intelligence, and have them avoid running in to each other. Collision detection without that will just make your enemies look stupid anyway - people avoid each other, they don't generally collide.
Look up "flocking" for some simple behaviours.
The basic idea is that things should head towards the player, but away from a close obstacle (each other, walls, that kind of thing).
No comments:
Post a Comment