Sprite Particles

Particles are designed to take up very little resources. That means that they must be one frame, one size, and one color of course... or do they?
Ordinarily if you wanted to change the color on the fly that would mean changing every other particle that was emitted as you are changing the emitters color filter, not the individual particle.
A cool new feature lets you select another object(within reason) to act as the particle. That means there are a bunch of options and effects you can do with them now. Lets get started with just making our particles have different colors!
First make sure, as always, that you get the order correct.
I wanted to make it look like the particles were spawning from behind the center image.
Remember particles have to be one size. A circle works well.
Of course we still have to keep the emitted object squared as a requirement for Particles(there is a way around that!)
To set the Sprite as out replacement look over in the Particles PROPERTIES on the left side panel.
The option an Object is down near the bottom.
Click on the ,,,
That will get you the dialog to set the available objects.
BTW the particles in this project spray upwards.
Set the gravity to a negative value to do that.
















Now on to events.
+ Sprite2: On created
-> Sprite2: Set color to random(10)>5 ?rgb(255,121,47) :rgb(0,0,0)
So the "cheat" the regular particle requirements we can use the On Created event, and we can do pretty much anything we can think of.
In this case it was just setting the particles color filter to orange or black in a round about fashion with a 50% chance... sort of.
Of course this uses in line conditional ternary operators.
Its a little advanced, and should be a small tut in itself.

Find the source: Here

Comments