Hello all,
I have yet another problem that I have run into and am having trouble with.
For my game I created an auto-turret. What I want it to do basically is pick the nearest enemy (there are multiple enemy types, so I chose the family as the target which contains all enemies), rotate towards it and if it is within a certain distance (say, 700 pixles) then it will fire at the enemy.
I can get this to half work, basically. It will sometimes target an enemy and shoot at it, but it will often ignore the closest enemy, and once it 'targets' an enemy, it will always rotate towards it even if there are closer targets at hand until the target it was fixated on is dead, and then it will go and kill a couple of other monsters and then it will just stop targeting anything for awhile (it seems to come and go in spurts).
Here is what the events look like at the moment. Maybe I am just sleep deprived but I can't tell where I went wrong. Any help/advice is greatly appreciated. Thank you!
<img src="http://img832.imageshack.us/img832/7853/whyyyyy.png" border="0" />