In this game I’m making, I am trying to use a “for” loop to detect if a certain enemy (who is in a movieclip named “world”) is touching a stone wall (specifically called “blocker9”). This is the code I’m using:
for (e=1; e<180; e++) {
theEnemy = world["enemy"+e];
theBlocker = world["blocker"+e];
if (theEnemy.hitTest(theBlocker)) {
trace("hit");
}
}
Whenever I put “world.blocker9” instead of “theBlocker”, it works. I don’t know why. Thanks for any help in advance. :hr: