Brauche gar keinen code zu schreiben... unter Ent_decal stehen in der Anleitung die besten Beispiele...#
BMAP* bmMark = "blood.dds";
SOUND* sndShot = "bullet.wav";
// control a decal-placing gun with the camera
function use_decal_gun()
{
while (1)
{
// calculate the target vector
VECTOR trace_target;
vec_set(trace_target,vector(5000,0,0)); // the weapon has a firing range of 5000 quants
vec_rotate(trace_target, camera.pan);
vec_add(trace_target, camera.x);
// display a red spot at the target position
if (c_trace(camera.x,trace_target, IGNORE_PASSABLE | USE_POLYGON| SCAN_TEXTURE) > 0) // hit something?
draw_point3d(hit.x,vector(50,50,255),100,3);
// fire and then place a decal at the hit position
if (key_ctrl) // fire
{
if (HIT_TARGET) // target hit?
{
PARTICLE* p = ent_decal(you,bmMark,7+random(3),random(360)); // place a random sized decal at the hit entity
p->lifespan = 1600; // remove decal after 100 seconds
}
snd_play (sndShot,100,0); // play the shot sound at a volume of 100
wait(-0.5); // reload
}
wait(1);
}
}