Project 93: Explosions

4. Handle a Hit Event

Show and set the clones to be right under the target when it's hit. Then we will have the particles broadcast an explode event.
Starting point file for this challenge

Your goal

Steps

1. Switch to the Particle Sprite

In the Sprite menu click on the "Particle" sprite and make sure it's highlighted blue before we start coding it.

2. Receive the Hit Message

In the Yellow Events tab look for the "when I receive __" block and add it to the side of the “when green flag clicked” block.

3. Setting X and Y Coordinates

Like in the "Target" sprite, let's grab a "set x to __"  and  "set y to __" block, and clear the entries in them.

4. Use Mouse Coordinates.

If we click on a "Target" we want to be able to use the mouse's position to help us spawn particles.  Head to the Light-Blue Sensing Tab and grab a "mouse x" block, and match it with the correct Coordinate.  

5. Mouse Y-Coordinate

Repeat the previous step with "mouse y" this time!

6. Make the Particle Show Up

Let's make the Particle appear by tacking on a “show” block from the Purple Looks Tab.

7. Broadcast an Explosion

Now that we have set our particle at the mouse click, let's broadcast a new event called "explode"  remember to use the little white upside down triangle to help you find the "New Message" button.