So i’m pretty new to all this and I was thinking …
if I had a bunch of enemies running around the screen each one would need to have its own unique name if I wanted to kill one without it despawning all of them in the entire game…this is my code attempting to do that
var index:int = 1;
for each (shroomDude in list)
{
var s:String = index.toString();
// add it
var shroomDude[s]:shroomDudeEntity = new shroomDudeEntity(shroomDude.@x,shroomDude.@y));
index++;
}
but i get the error “expecting semicolon before left bracket”. am I using the brackets wrong? and is this the best way to do this? or is there another way to access a colliding entity without forcing it to have a unique name