Ya, the smoke should spray only once, not through out the game.
The game has 4 levels and only in 2nd level smoke has to be sprayed and only once(ie., when 'M' is presses and should stop after we release 'M')
after that the player has to perform other actions(ie., has to go and touch the skycar...). But using the below code.., the smoke is visible throught out the game(ie., in all the levels after we execute this function).
But, it has to spray when we click on_M and stop spraying after we release the button.
BMAP px_tga = "smog_02.tga";
function fade_p()
{
my.alpha -= 10 * time_step;
if (my.alpha < 0) {my.lifespan = 0;}
}
function effect_x()
{
my.alpha = 30 + random(65);
my.flare = on;
my.bmap = px_tga;
my.size = 12;
my.bright = on;
my.move = on;
my.function = fade_p;
}
function create_px()
{
while (1)
{
vec_set(temp,vector(20,0,0));
vec_rotate(temp,(plBiped01_entity.pan);
vec_add(temp,(plBiped01_entity.x);
effect(effect_x, 1, temp, nullvector);
wait (1);
}
}
on_m = create_px;