Explode Enemy with hitTest
Wrap and Review
The built-in hitTest function can make collision detection much easier. It won't work for everything. Notice that hitTest will check to see if any part of one MovieClip is hitting another. This means that MovieClips with curved or odd shapes can give unwanted results.
Check it out... do you think these two objects are hitting:
Look again:
They are hitting.
What We Did
We used an IF statement in combination with the hitTest function to check and see if two MovieClips are touching:
if(clipA.hitTest(clipB)==true){
}
Self Check for Understanding
Here's a challenge for you! Can you use the same hitTest technique to check if the ship is hitting the enemy? I suggest you start an IF statement right after you move the enemy (in the onEnterFrame function).