Help with enemy AI.

FlayrFlayr Member Posts: 3
edited July 2012 in Working with GS (Mac)
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

Comments

  • PuzzlePlatformerManPuzzlePlatformerMan Member Posts: 23
    edited July 2012
    Do you have the physics of the tanks set so that they collide with each other, and don't overlap? Basically, I think what you'd need to do is set the physics so that when the tanks collide, they, if nothing else, collide with each other, and travel in a left to right line, instead of overlapping each other. I'm almost certain it has something to do with their physics. Hope this helps.
Sign In or Register to comment.