hi,
I’m trying to make a game… sorta along the lines of Command and Conquer… or Age of Empires… the basic idea is the same…
What i have is… 1 unit… and maybe… 10 enemy units on the screen… ( it’s a birds eye view by the way… )
Lets say… my 1 unit moves around… and if it hitTests the other enemy units… then … they both explode… lol
Anyway… I’m just asking… how should i script this… best?
I thought of maybe having an array of enemy units… and then do a enterFrame with a loop in the array checking for each enemy unit…
e.g.
enemiesunits = [enemy1,enemy2,enemy3,enemy4,enemy5,enemy6,enemy7,enemy8,enemy9,enemy10]
[on my unit]
onClipEvent(enterFrame){
for(i=0;i++,i<enemiesunits.length){
if(enemiesunits*.hitTest(this)){
go to MEGA EXPLOSION
}
}
}
But having loops for every onEnterFrame… wouldn’t that slow flash down… LOTS!! Espeically… when i start getting more than one unit!
So… What other ways… that’s better of scripthing this?