i got one big mc called walls2 and it supposed to be used on a onenterframe movieclip you know.
first i just had one wall it worked 50% if the enemy was on the left side it teleported to the right of it
and at the otehr wall the same thing.
Code:
while(bunker1ro.hitTest(tempEnemy)){
tempEnemy._y+= enemyArray[i].speed;
tempEnemy._x+= enemyArray[i].speed;
}
while(bunker1lb.hitTest(tempEnemy)){
tempEnemy._y-= enemyArray[i].speed;
tempEnemy._x-= enemyArray[i].speed;
}
with this code they jsut all go to one point because to want to get to you and you have a super zombie lol..
and this one i use for the player in the player_mc it self.
Code:
while(_root.walls2.hitTest(_x, _y+radiuss, true)){ _y-enemyArray[i].speed; } while(_root.walls2.hitTest(_x, _y-radiuss, true)){ _y+enemyArray[i].speed; } while(_root.walls2.hitTest(_x-radiuss, _y, true)){ _x+enemyArray[i].speed; } while(_root.walls2.hitTest(_x+radiuss, _y, true)){ _x-enemyArray[i].speed; }
this one works great
if he hits something in walls2 he will stop[the player]
but now i want to add this one to the enemy but ofcourse they are added into the game with script so they dont have a mc to put this is..
i tried to put it in here the hittest function
Code:
function checkEnemyHitt(_enemy:MovieClip):Void { for(var i = 0; i < enemyArray.length; i++) { var tempEnemy:MovieClip = enemyArray[i]; while(bunker1ro.hitTest(tempEnemy)){ tempEnemy._y+= enemyArray[i].speed; tempEnemy._x+= enemyArray[i].speed; } while(bunker1lb.hitTest(tempEnemy)){ tempEnemy._y-= enemyArray[i].speed; tempEnemy._x-= enemyArray[i].speed; } while(_root.walls2.hitTest(_x, _y+radiuss, true)){ _y-enemyArray[i].speed; } while(_root.walls2.hitTest(_x, _y-radiuss, true)){ _y+enemyArray[i].speed; } while(_root.walls2.hitTest(_x-radiuss, _y, true)){ _x+enemyArray[i].speed; } while(_root.walls2.hitTest(_x+radiuss, _y, true)){ _x-enemyArray[i].speed; }
after i played this script it stops when the enemys are spawned and the game freezes and after a few seconds i tells me to abort the script.
If you need more info just ask.
I hope you can tell me what i do wrong.
Greetings
Reaven












] the enemys so i can hitest them with eachother?
im still learning 



