I'm developing a flash game called Frog, at the moment my code for collision between my frog and fly doesn't work as expected. I'd like to have it so it works something similar to the method linked below (last example).
Collision detection methods, hitTest and hitTestObject alternatives
Any help would be appreciated.
function hitTargetFunction():void {
for (i = 0; i < insectsMC.length; i++) {
for (j = 0; j < insectsMC[i].length; j++) {
if (frogMC.hitTestObject(insectsMC[i][j])) {
trace('Target: ' + insectsMC[i][j].name);
score += 1;
trace('Score: '+score);
insectsMC[i][j].x = 0 - insectsMC[i][j].width * 2;
}
}
}
}