From the manual (look for "effect" or "effect_local"):
Code:
// helper function: sets the vector to random direction and length
function vec_randomize (&vec, range)
{
vec[0] = random(1) - 0.5;
vec[1] = random(1) - 0.5;
vec[2] = random(1) - 0.5;
vec_normalize(vec,random(range));
}
// helper function: fades out a particle
function part_alphafade()
{
my.alpha -= time + time;
if (my.alpha <= 0) { my.lifespan = 0; }
}
// particle function: generates a fading explosion into vel direction
function effect_explo()
{
vec_randomize(temp,10);
vec_add (my.vel_x, temp);
my.alpha = 25 + random(25);
my.bmap = scatter_map;
my.flare = on;
my.bright = on;
my.move = on;
my.function = part_alphafade; // change to a shorter, faster function
}
...
vec_scale(normal,10); // produce an explosion into the normal direction
effect(effect_explo,1000,my.x,normal);
It uses the last parameter of the "effect" function to set the velocity vector of the particles, to the normal-direction.