I am pulling my hair out, I have checked several of my flash books, Google, forums, and I cannot seem to get this hitTest to work. 1st frame on the stage (actionscript layer), is where all my code is at. I first, called a movieClip to the stage:
_root.attachMovie(“enemy01”, “enemy01”, 0());
enemy01._x = 750;
enemy01._y = 300;
Perfect! I got the movieclip! NOW, i want to hitTest this movieclip against the Hero:
if (_root.Hero.hitTest(_root.enemy01._x, _root.enemy01._y)) {
removeMovieClip(_root.enemy01);
}
No errors, the enemy is attached to the stage at the desired x/y coordinates, and no hitTest working. HOWEVER, if I use this code:
if (_root.Hero.hitTest(_root.enemy01._x, _root.enemy01._y)) {
_root.enemy01._visible = false;
}
The hitTest works perfectly. As soon as the Hero touches the enemy01 from any direction, the enemy01 disappears because of the hitTest. I don’t want the enemy to be hidden, I want the enemy removed from the stage if the Hero hits it. What am I missing?