Making games
Particles
A Particle Emitter throws out small sprites that move, grow or shrink, change color and die: smoke, sparks, dust, rain, magic. Scene → Particles creates one already playing, and it plays in the editor too, so you can tune it while you watch.
Emission
| Property | What it does |
|---|---|
| Playing | Emitting at all. Turned off, nothing new appears and what’s alive finishes its life. |
| Rate | Particles per second. |
| Burst | Particles thrown out at once when it starts. |
| Looping, Duration | Emit forever, or for Duration seconds and stop. |
| Max particles | The most alive at once. Emission waits for room rather than replacing old ones. |
| Shape | Where they come from: a Point, a Sphere of Radius, or a Cone (up, spreading by Angle). |
| Space | World leaves particles behind as the emitter moves, like a trail; Local carries them along, like a flame on a torch. |
Each particle
Lifetime, speed and size are each two numbers: a particle picks a value at random between them.
| Property | What it does |
|---|---|
| Lifetime | Seconds it lives. |
| Speed | Units per second it leaves at. |
| Size, Size at death | Its size when born, and its size when it dies as a multiple of that (0 shrinks to nothing, 2 doubles). |
| Color, Color at death | Blended across its life. Fade Color at death’s alpha to 0 for smoke that thins out. |
| Gravity | 0 floats, 1 falls like a stone, negative rises (smoke, bubbles). |
| Drag | How fast it slows down. |
| Texture | The sprite. Empty is a soft round dot. |
| Blend | Alpha for smoke and dust, Additive for fire, sparks and magic, which brighten what’s behind them. |
| Seed | 0 is different every time; any other number plays out the same way every time. |
From a script
fn on_collision(other, normal) {
// A puff of sparks from an emitter that's otherwise off.
self.get_component("ParticleEmitter").emit(20)
}
An emitter’s emit(count) throws out particles at once, whether it is playing
or not. play() starts it emitting (a non-looping one starts its duration and
burst over), stop() stops it while what is alive finishes, and clear()
removes every live particle. They take effect on the next frame, like every
change a script makes. See Component
actions.