H4T
December 13th, 2004, 11:47 AM
I have a simple FOR loop which runs through an array of MC names, which runs fine, but I'm trying to use these names inside this array as hittest values. So, I have one MC, and the code in this MC runs through an array and checks for any collisions between it and the mc in the array.
for(k=0; k<herbNames.length; k++) {
if(name.hitTest(herbNames[k])) {
trace(name+" hit "+herbNames[k]);
}
}
So, how should I do the hitTest? Here is my idea, but because of the size of the mcs involved, I don't want to sit around all day waiting for the correct collisions to occur, lol. Here is what I had in mind..
if(name.hitTest(herbNames[k])) {
trace("Collision!");
}
Would that work? Or...something else? Is there maybe a more effecient way to do this (maybe a FOR...IN loop?)?
for(k=0; k<herbNames.length; k++) {
if(name.hitTest(herbNames[k])) {
trace(name+" hit "+herbNames[k]);
}
}
So, how should I do the hitTest? Here is my idea, but because of the size of the mcs involved, I don't want to sit around all day waiting for the correct collisions to occur, lol. Here is what I had in mind..
if(name.hitTest(herbNames[k])) {
trace("Collision!");
}
Would that work? Or...something else? Is there maybe a more effecient way to do this (maybe a FOR...IN loop?)?