Posted By: dos
Particles / effect crash - 11/26/08 20:51
Hi:
I tied the script in the online manual about particle effects:
Every time I run the code Gamestudio crashes.
http://www.conitec.net/beta/aent-effect.htm
Any Idea?
Thanks for any help in advance!
I tied the script in the online manual about particle effects:
Code:
// helper function: sets the vector to random direction and length
function vec_randomize (var* vec, var 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(PARTICLE *p)
{
p.alpha -= 2*time_step;
if (p.alpha <= 0) p.lifespan = 0;
}
// particle function: generates a fading explosion into vel direction
function effect_explo(PARTICLE *p)
{
var temp[3];
vec_randomize(temp,10);
vec_add (p.vel_x, temp);
p.alpha = 25 + random(25);
p.bmap = scatter_map;
p.flags |= (BRIGHT | MOVE);
p.event = part_alphafade; // change to a shorter, faster function
}
function main()
{
level_load("");
vec_scale(normal,10); // produce an explosion into the normal direction
effect(effect_explo,1000,my.x,normal);
}
Every time I run the code Gamestudio crashes.
http://www.conitec.net/beta/aent-effect.htm
Any Idea?
Thanks for any help in advance!