What it does
Every spark is a thin streak turned along its velocity and stretched by its speed, so a fast spark is a long line and a slowing one shrinks to a point. Sparks fall under gravity and thin as they cool from white through gold and orange to a dull red, additive so they glow. Around them each effect layers what sells it: a flickering glow at the source, falling grit, a flash, a ring, smoke or fumes.
Spawn one with game.particles.effect(name, opts). Loops stay until kill() and one-shots remove themselves, so you
fire one per hit; every effect can follow an object. angle aims the grinder and the ricochet, but gravity keeps the
world's down, so a grinder aimed up still rains its sparks down. scale sizes everything: metalHit at twice is a
giant's sword.
Features
- Machines — a spark fountain, a
weldingpoint, anelectriccrackle, an aimedgrinder, and ashortCircuitthat sputters on an uneven beat. - In the hand and overhead — a
sparkler, and asparkShowerraining from a ceiling 120 units up. - Hits — a
ricochetskipping away along an angle, ametalHitclang and alaserHit. - Forge and fire — a hammer on an
anvil, and anemberBurstas a log breaks. - Light on particles — the busiest,
grinder, holds about 200 live particles; the one-shots 25 to 50. - Data you can copy — retune any effect by copying its definition under a new name.
Good for
- Action and fighting games — sword clashes and bullets striking armour.
- Shooters — ricochets off walls and blaster bolts landing.
- Industrial and sci-fi levels — welders, grinders, broken machines and sparking cables.
- Crafting and blacksmith games — a hammer on the anvil and embers from the forge.
Make it yours
Pick an effect, size it with scale and aim the directional ones. A shooter fires a ricochet along each bullet's
reflected direction when it hits metal, and gives a damaged boss a looping shortCircuit; a blacksmith game fires
anvil on each hammer blow and throws an emberBurst when the forge is stirred.
A quick look
A short circuit at a point, a grinder's shower, a ricochet on every hit and a shower from a broken ceiling:
const fault = game.particles.effect('shortCircuit', { x: 410, y: 120, layer: 'fx' });
const shower = game.particles.effect('grinder', { follow: tool, offset: { x: 12, y: 0 }, angle: 200 });
const ricochet = (x: number, y: number, deg: number) => game.particles.effect('ricochet', { x, y, angle: deg });
game.particles.effect('sparkShower', { x: 300, y: floorY, scale: 0.8 });
Works with
particles-2dandparticle-textures— required;core-2dincludes both.lighting-2d— for the light a weld or a short circuit throws.audio— for the crackle and the clang.vfx-explosion— a whole explosion, and a smaller, plainer directional hit spark.vfx-lightning— bolts, and arcs between two points.vfx3d-sparks— the same twelve names in 3D.
Good to know
- Sparks fall through the floor: nothing collides with the level, except that
sparkShowerstops at its anchor's height. Give a copied emitter asolidtest for sparks that skitter. - Additive sparks wash out on white backgrounds, and they light nothing themselves.
- None is a trail: they follow an object but do not emit by distance travelled.






