I have two different arrays of swordmen, one is called eswordmen and the other swordmen. I would like that when they hittest eachother they gotoAndPlay at frame 6 where the hit animation is. But then they always hitTestObject eachother, so they will gotoAndPlay(6) each frame and the animation won't run...
I fixed this making a var hitOn, and they only hit eachother if that var is true, and when they hittest eachother i set that var to false.
But now I wan't to make more swordmen than just 2, and then that method won't work... Can some one please help me? How can this be done? It may sound a bit complicated but hope you understand my problem...
Here is my code:
//Actionscript 3.0
var hitOn:Boolean = true
function checkForHits(event:Event) {
if (swordmen[swordmenNum].hitTestObject(esw ordmen[eswordmenNum])) {
if (hitOn == true) {
eswordmen[eswordmenNum].gotoAndPlay(6);
swordmen[swordmenNum].gotoAndPlay(6);
hitOn = false
}
}else {
if (hitOn == true) {
for(var eswordmenNum:int=eswordmen.length-1;eswo rdmenNum>=0;eswordmenNum--) {
eswordmen[eswordmenNum].x -= 5
}
for(var swordmenNum:int=swordmen.length-1;swordm enNum>=0;swordmenNum--) {
swordmen[swordmenNum].x += 5
}
}
}
macco
(And yes, i love "Agnry Faic")
}