here is the code i took from you and my rocket code:
------------------------------------------
function fade_smoke(PARTICLE *p)//fade the smoke
{
p.alpha -= .2 * time_step;
p.size+= .4 * time_step;
if (p.alpha < 0) p.lifespan = 0;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function smoke(PARTICLE *p)//smoke partical effect
{
p->vel_x = ( .1 )-random(.2) ;
p->vel_y = ( .1 )-random(.2) ;
p->vel_z = random( .1 );
p.alpha = 10 + random(10);
p.bmap = smoke_tga;
p.size = 10+random(2);
p.flags |= ( MOVE);
p.event = fade_smoke;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function big_explosion()//explosion from the mortar shell
{
my.roll=random(360); //make it look a little different each time
my.scale_x=1.2;my.scale_y=my.scale_x;my.scale_z=my.scale_x; //scale it up a bit
c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS); my.z = hit.z +2;//place just above ground
VECTOR temp; //a temporary vector
set(my,PASSABLE | BRIGHT | TRANSLUCENT | UNLIT);//attributes
my.alpha=100;//fully visible
vec_set(temp,camera.x);vec_sub(temp,my.x);vec_to_angle(my.pan,temp); //look at the cam
while(my.frame<20)//play all its frames
{
my.alpha -= 1 * time_step;
my.frame+=1*time_step;
wait(1);
}
my.frame=0;
wait(1);
ent_remove(my); //bye bye
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
function big_burn() //burn from the mortar shell
{
my.scale_x=4;my.scale_y=my.scale_x;my.scale_z=my.scale_x;
c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME|IGNORE_SPRITES|IGNORE_MODELS); my.z = hit.z +1;
VECTOR temp;
set(my,PASSABLE | TRANSLUCENT);
my.alpha=100;
my.pan=random(360);
while(my.alpha>0) //fade it out slowly
{
my.tilt=-90;
my.alpha-=.4*time_step;
wait(1);
}
wait(1);
ent_remove(my);//bye bye burn
}
function rocket_event()//event triggered when shell makes contact
{
my.event=NULL;//stop future instances of this function
//vec_set(my.x,my_target.x);
//snd_play(exploend_wav,100,NULL);
ent_create("explo+20.tga",my.x,big_explosion);//this explosion is upright and faces cam
you=ent_create("explo+20.tga",my.x,big_explosion);you.tilt=-90;//same explosion tilted and placed on the ground
ent_create("burn.tga",my.x,big_burn);//burn tilted and placed on the ground
c_scan(my.x,my.pan,vector(360,180,400),SCAN_ENTS | SCAN_LIMIT);
wait(1);
ent_remove(my);//bye bye shell
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
action player_rocket()
{
var fall_speed = 0.9;
VECTOR procket_speed;
wait (1);
my.skill40 = 1;
my.pan = you.pan;
my.tilt = you.tilt;
my.emask |= ENABLE_BLOCK | ENABLE_ENTITY;
my.event = rocket_event;
my.skill5 = 0;
procket_speed.x = 100 * time_step;
procket_speed.y = 0 * time_step;
procket_speed.z = 0 * time_step;
//procket_speed = * time_step;
while (my != NULL)
{
c_setminmax(me);
my.skill5 += time_step;
if (my.skill5 > 20)
{
procket_speed.z -= fall_speed * time_step;
}
move_mode = IGNORE_YOU + IGNORE_PASSABLE;
ent_move (procket_speed.x, nullvector);
wait (1);
}
}
------------------------------------------
thanks!
- Muhsin Kaymak