Most effective way for hitTesting

Alrighty, I’m making a missile command game, you can see the test version here.

I was wondering what would be the easiest/most effective way to hitTest the duplicated missiles with the duplicated rockets. Right now I’m using a for loop, the only problem with that is when there are multiple rockets on the screen using the for loop to hitTest the missiles it becomes very laggy. Any better ways to hitTest you think?

Um, well, getting the rockets to blow-up when they hit each other and removing each instance would probably help you out, for starters :¬)

That’s only a test version, though the missiles you fire are removed when they go off screen. I’m just looking for a more efficient way to do the actual hitTest when they hit eachother :expressionless:

for…in loops are made for this purpose. Can you post your code?

Well, here is the way im hitTesting right now:

if (this != _level0.rocket) {
for (e = 0; e < 50; e++) {
if (this.hitTest(_root[“missile”+e])) {
this.removeMovieClip();
}
}
}
}

Heres a link to the .fla if you wanna poke around in it. I know it’s probably not written to well, I am going to re-write everything out so I can add all the features in easier.

http://webpages.charter.net/rrahlf/Version1.fla