Making Different Kinds of Particles
Here is a brief overview of the particles. We will look at some practical examples. Let’s take a look at how to spawn particles. So let’s add in Touch and go to our Event sheet.



We will move to System.


Select On start of layout.

We will destroy particles.



Let’s eliminate all the particles that we need to. We’ll go to Touch and choose On any touch start.



Go to System and create an object, which will be particles at Touch.X and Touch.Y—pretty simple stuff.






And look at that.




There are enough fireworks around. I can click left, right and center.





That seems pretty cool. Let’s also look at other effects; we want to generate some random events. So to look at all the features I just talked about, we can manipulate and see this.





We’ve already helped you know about the angle, but the initial properties of the particle are what we’re looking for. So let’s say we want any of these here to set the speed to random.

And we can set random (0,2000).

And when you’re testing these scenes, you want to go hyperbole.





You can see that all of these here are quite a bit different.





So maybe let’s set it to 1000.





They all go at different sizes, and at some point, things get so fast it is.


That one is quite a bit different. But you can see that it sets a random speed. So you can do pretty much any one of these here.



You can select any of those properties that we just set up. So you know the opacity, you can do a random 20 and 100.







Let’s take a look at maybe one more here.



So when you spawn one of these, you need to set any random events. So this is the way to do it. And it’s also good to set up these unexpected events when you set up a particle; setting something up that’s random will give your game a little bit of life. So I think the Set size randomiser is what we’re looking for, and we’re going to do randomization from 1 to 100, and let’s see what this does.






Looks pretty great. And you can see that adding a block aesthetic, as discussed in the series, looks great.





And there’s another thing we can do; we’re looking for a random rate between 50 and 500.










It is working fine. It would not work if you were to do this on a mobile device. So keep that in mind. That is an excellent way to make explosions.



The last thing you can probably randomizer is Set speed randomiser.



The speed is how fast the particles are going. The randomiser for each particle was randomly set in speed, so the speed was random, or you could make it.






That looks pretty cool. And whenever you play around with this, you want to think of how this affects you. It is a very kind of explosion. The other ones were very uniform and very coordinated. It is just like the final explosion.




It would be cool to make a game with this kind of particle here. So that’s how you add in randomization, and that’s an excellent way to use it. Now the last thing is that whenever you create a particle and want different particles with different randomization, let’s say you have ten different enemies with ten various particle explosions. So you’d have to create all ten explosions as a different particle, and each of these is designed here. And that’s something that you can do in your game. It doesn’t take long to add this extra step. Adding this extra step makes your games look quite a bit better.