Step 8: Destroying the Enemy Body

When the player shoots an Enemy directly in the body, we want to also destroy both wing objects:
Once again, MMF2 generates the Object Scope. The first condition removes all Enemy and Bullet instances not overlapping the other from the list. Next, MMF2 checks each Left Wing individually to see if it's ID value matches the LeftWingID value of the Enemy remaining in the scope, and any Left Wing objects that don't match are removed from the scope. Finally, MMF2 executes destroys and Left Wing objects remaining in the scope. This will either be 1 or 0.

Now, repeat the event, but for the Right Wing object:
You probably noticed that we didn't destroy the Enemy (body) or the Bullet in either of these events. This is because we have to compare both wing IDs separately and we need the Enemy to do that. The final step is to destroy the Enemy and the Bullet, like so: Well done, you have completed the tutorial! For further information on handling multiple instances and the MMF2 Object Scope, please read the Object Scope article. Until next time my friend...

11