I'm trying to add 10 enemies and when I shoot each of them, they explode. What's happening now is there is 10 enemies being added to the screen and only 1 of them can be destroyed. All my bullets are being pushed in bulletArray and the collisions are all fine. There is no way of telling which one the explodeable enemy is, but I used to have some basic code that made them follow the player which would only be applied to one of them just like this explosion is. Suggestions? I thought of perhaps pushing the enemies to an array but am wondering if there if an easier way because I really resent being an array hoar. Why can't I create enemies like I roughly did in the following example? Thanks. By the way I'm mostly curious why it won't work not how to fix it but those might go hand in hand. I know pushing to an array works.
for (var j:int = 0; j < 10; j++)
{
var follow:Follower = new Follower();
addChild(follow);
var randomY:int = (Math.random()*500);
var randomX:int = (Math.random()*650);
follow.x = randomX;
follow.y = randomY;
}
for (var i:uint=0; i<bulletArray.length; i++)
{
if (collisiondetection.isColliding(follow, bulletArray[i], 1))
{
for (var h:Number=0; h<20; h++)
{
makeExplosion();
}
removeChild(follow);
}
}