The engineβs Particle System allows the creation of dynamic visual effects such as fire, smoke, sparks, rain or explosions. It is fully compatible with hierarchy, layers and visibility, and can work independently or as a child of any object.
A particle system is defined as an object of type ParticleSystem:
{
"type": "ParticleSystem",
"playOnStart": true,
"looping": true,
"simulationSpace": "local",
"startDelay": 0,
"destroyWhenDone": false,
"particleData": { ... }
}
playOnStart β Automatically starts emitting when pressing Play.looping β If true, the system restarts when its duration ends.simulationSpace β Controls whether particles move with the emitter (local) or remain fixed in the world (world).startDelay β Delays the beginning of the emission (in seconds).destroyWhenDone β Destroys the system when it ends and no particles remain active (only if looping = false).particleData Parameters{
"rate": 20,
"life": 1.5,
"speed": 100,
"spread": 6.283,
"color": "#ffaa00",
"gravity": 0,
"texture": "spark.png",
"sizeMin": 4,
"sizeMax": 12,
"opacityMin": 0.5,
"opacityMax": 1,
"duration": 5
}
rate β Particles emitted per second.life β Lifespan of each particle (seconds).speed β Initial speed of particles.spread β Emission angle in radians (Math.PI * 2 = full circle).color β Base color of particles.gravity β Vertical acceleration applied during their life.texture β Image used as particle sprite.sizeMin / sizeMax β Random minimum and maximum particle size.opacityMin / opacityMax β Random minimum and maximum opacity.duration β How long the system keeps emitting.particles[]).
Each particle has its own position, velocity, life, size and opacity.
playOnStart starts emission automatically.startDelay delays the beginning of the emission.looping restarts emission when duration ends.destroyWhenDone removes the system when no active particles remain (if loop is disabled).looping is enabled, the destroyWhenDone parameter is ignored.
A particle system can be the child of any object. When it is, it inherits position, rotation and scale like any other engine object.
local mode).{
"type": "ParticleSystem",
"playOnStart": true,
"looping": true,
"simulationSpace": "local",
"particleData": {
"rate": 20,
"life": 1.5,
"speed": 50,
"color": "#ff6600",
"gravity": -30
}
}
{
"type": "ParticleSystem",
"playOnStart": true,
"looping": false,
"destroyWhenDone": true,
"particleData": {
"rate": 200,
"life": 0.8,
"speed": 300,
"spread": 6.283,
"color": "#ffaa00"
}
}
{
"type": "ParticleSystem",
"simulationSpace": "world",
"looping": true,
"particleData": {
"rate": 100,
"speed": 400,
"gravity": 600,
"life": 2,
"color": "#66aaff"
}
}
rate on mobile devices (10β30).visible when the system is off-screen.destroyWhenDone for single-shot effects (explosions, impacts, etc.).local with looping for continuous attached effects.gravity and narrow spread produce smooth smoke-like effects.
High values produce chaotic effects such as fire or explosions.
PlayParticles() and StopParticles()Besides editor configuration, particle systems can be controlled dynamically through scripts using two key functions:
PlayParticles(obj);
StopParticles(obj);
// Alternative usage by passing the object name
PlayParticles("Particle");
StopParticles("Particle");
PlayParticles(obj) β Immediately starts emitting particles, regardless of playOnStart.StopParticles(obj) β Stops emission, but keeps existing particles until they fade out.PlayParticles("Particle") β Passing the object name as parameter.StopParticles("Particle") β Passing the object name as parameter.ParticleSystem object or inside components[] of another object.
let ps = getObjectByName("ExplosionFX");
PlayParticles(ps);
StopParticles(getObjectByName("SmokeExit"));
function OnCollision(obj, other) {
let fx = getObjectByName("HitFX");
PlayParticles(fx);
}
Timer(1.2, () => {
PlayParticles(getObjectByName("Sparks"));
});
playOnStart is false.looping, startDelay and destroyWhenDone.
simulationSpace defines whether particles follow the emitter.destroyWhenDone removes the system when finished (no loop).