I converted an A6.6 "game" over to A7/Lite-C, and have one last thing to fix...well, besides that ent_create/physics thing.
So, anyway, here is my problem: I cannot get particle effects to work. My app throws an "Invalid arguments in someEvent" error messagebox on any "effect(...);" line that I throw at it. I've got several tried and true effects and none of them work. As a matter of fact, I cut and past the lite-C code excerpt from the manual and it still crashes on the "effect(...);" line. When I try to walk through the debugger, all I get is the same error messagebox on that line.
Following is the code. Any ideas? Do I need to add the obligatory "wait(1);" somewhere or something?
Thanks for the help.
Code:
...
BMAP* spark_map = "spark.tga";
VECTOR temp;
...
void main() {
...
}
void someAction() {
...
my.event=someEvent;
...
}
void someEvent() {
...
vec_scale(normal,10); // from the manual
effect(effect_explo,10,my.x,normal); // CRASH!!!!
...
}
/// the following funcs are from the manual.
/// the only change is the BMAP utilized in effect_explo
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)
{
vec_randomize(temp,10);
vec_add (p.vel_x, temp);
p.alpha = 25 + random(25);
p.bmap = spark_map;
p.flags |= (BRIGHT | MOVE);
p.event = part_alphafade; // change to a shorter, faster function
}