Help with enemy AI.
![Flayr](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Hello everyone, I am making a story driven tank game and am having trouble with my enemy AI. Although I have made other enemies following the same AI i already have I am currently working with two actors: TestPlayer and TestEnemy. Test Player is controlled with the arrow keys to move around the screen and other keys to fire different weapons. TestPlayer also has two constrain attribute behaviors setting it's x and y to the variables "PlayerX and "PlayerY". TestEnemy is set to lower its variable "HP" when hit and destroy itself when "HP" is zero. All of this works fine until I get into the enemies movements.
It has only to behaviors relating to movement: A rotate to position attribute set to "PlayerX" and "PlayerY" with a rotation speed of 20 and a move behavior set to move straight at a speed of 15. The enemy does always turn towards the player and move forward causing it to successfully chase it but there is an issue. When I put more than one enemy on the field they all run into each other and eventually just travel as one huge mass layered over one another.
My question is how do I make it so the enemies always move away from each other and also advance on the player. I dont mind scraping all of my old AI. I would also like to be able to make them avoid walls and obstacles because that is equally necessary for my game.
Under the assumption someone does help me, thanks in advanced,
-Flayr
It has only to behaviors relating to movement: A rotate to position attribute set to "PlayerX" and "PlayerY" with a rotation speed of 20 and a move behavior set to move straight at a speed of 15. The enemy does always turn towards the player and move forward causing it to successfully chase it but there is an issue. When I put more than one enemy on the field they all run into each other and eventually just travel as one huge mass layered over one another.
My question is how do I make it so the enemies always move away from each other and also advance on the player. I dont mind scraping all of my old AI. I would also like to be able to make them avoid walls and obstacles because that is equally necessary for my game.
Under the assumption someone does help me, thanks in advanced,
-Flayr
Comments