Counting Game 7: Add Sparkle (Particles)

In this lesson we are going to add some sparkle each time the correct carrot is clicked.  This is a useful feature. Not only does it look cute, it also give an important visual cue to young players to indicate they have clicked the right carrot.

You will see this in action in the video below. The sparkle effect is triggered when the next carrot is clicked – but if the wrong carrot is clicked there are no sparkles 🙂

This is very straightforward to do. To create a sparkle effect like this, we simply create a ‘particle’ object and then instruct the system to recreate the particle effect every time the correct carrot is clicked.

Add Particles to the Game

We need to add a particle object. To do this, make sure you are on the Layout screen and right click. Select Insert New Object.

Now select Particles. As we’ve seen before, it will be quicker to start typing into the search bar to narrow down the options.

When you click ‘Insert’ the animation editor will open.

As you will see in the video at the top of the page, we are going to make white circles to use as particles to create the sparkle effect. Therefore draw a white circle in the center of the page using the circle tool.

Note, the circle will be drawn from the center out, so start drawing in the center of the canvas.

Don’t worry about it being a perfect circle as it won’t show when the particles are playing.

When you have drawn the circled, just close the window as it is automatically saved.

Tip: After you have closed the editor window, you will see the particle object has been created on the page. Move this away from the layout so none of the particles fall onto the layout unexpectedly.

Change the particle settings in the Property panel on the left. Remember to click on the particle icon on the layout in order to see the properties.

Add Action to Create Particles When the Correct Carrot is Clicked

Now all we need to do is to create an action which recreates the particles when the carrot is clicked.

To do this, we will use a function called ‘Spawn another object’. This means that an object (in this case our carrot) will create another object (in this case the particles) in its position. 

Therefore go to the Event Sheet and click ‘add new action’ to create a new action and select the carrot object and look for ‘Spawn another object’. Remember that typing in the word will help narrow down the choices:

And then choose the object you want to create – in this case the particles.

Now, when you preview the game, you will see the particles giving a sparkle effect when the correct carrot is clicked.

Your Event Sheet will now look like this:

Note: We have a 0.5 second wait when the opacity tween is playing. If you want the particles to take effect BEFORE this wait, simply drag the Spawn action above the Wait action.

Remember to save the game before moving to the next lesson 🙂