|
Re: can someone pls help me converter this to lice-c..
[Re: Joey]
#251615
02/14/09 05:05
02/14/09 05:05
|
Joined: Nov 2008
Posts: 29 Philippines
ZeroEight
OP
Newbie
|
OP
Newbie
Joined: Nov 2008
Posts: 29
Philippines
|
this is the way i converted it.. can someone pls tell what's wrong with it because when i move the camera the level just exits by it self and of course there's rain falling down.....
BMAP* smoke_tga = "laser_grey.tga";
//// particle alpha handling //////// function fire_part_alphafade(PARTICLE *p) { p.alpha -= 0 *time_step; if(p.alpha < 0) { p.alpha = 0; p.lifespan = 0; } p.skill_b += 0.03; p.skill_c = 6 - my.skill_b; if(p.skill_c < 0) { p.lifespan = 0; } }
///// particle creating ///////// function effect_fire(PARTICLE *p) { p.red = 128; p.blue = 128; p.green = 128; p.skill_c = 0; p.skill_b = 0; p.vel_x = random( 0 ) - 0 ; p.vel_y = random( 0 ) - 0 ; p.vel_z = -40 ; p.x += random(1000)-500; p.y += random(1000)-500; p.z += random(100)-50; p.alpha = 100; p.size = 14; p.bmap = smoke_tga; //set(p, BRIGHT); p.flags |= (MOVE); set(p, TRANSLUCENT); p.event = fire_part_alphafade; // change to a shorter, faster function } //// particle using ///////// action im_on_fire() { set(my, INVISIBLE); set(my, PASSABLE); while(1) { var rainAnzahlPartikel = 1; VECTOR temp; VECTOR* mypos = { x=0; y=0; z=0; } vec_set(mypos,camera.x); temp.x = cos(camera.pan); temp.y = sin(camera.pan); temp.z = 600*cos(camera.tilt); mypos.x = mypos.x + temp.z*temp.x; mypos.y = mypos.y + temp.z*temp.y; mypos.z = mypos.z + 600*sin(camera.tilt); mypos.z = camera.z + 800; effect(effect_fire,maxv(1,integer(rainAnzahlPartikel*time_step)),mypos,nullvector); wait(1); } wait(1); }
|
|
|
Re: can someone pls help me converter this to lice-c..
[Re: ZeroEight]
#251839
02/15/09 10:09
02/15/09 10:09
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
Expert
|
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
BMAP* smoke_tga = "laser_grey.tga";
//// particle alpha handling ////////
function fire_part_alphafade(PARTICLE *p)
{
p.alpha = p.lifespan -= time_step;
}
///// particle creating /////////
function effect_fire(PARTICLE *p)
{
p.vel_x = random(20)-10;
p.vel_y = random(20)-10;
p.vel_z = -40;
p.x += random(1000)-500;
p.y += random(1000)-500;
p.z += random(100)-50;
p.lifespan = 100; // has to be adapted
p.alpha = 100;
p.bmap = smoke_tga;
p.red = p.blue = p.green = 128;
p.size = 14;
p.flags |= (TRANSLUCENT | MOVE);
p.event = fire_part_alphafade;
}
//// particle using /////////
const var RAIN_COUNT = 1;
action im_on_fire()
{
set(my, INVISIBLE | PASSABLE);
while(1)
{
VECTOR temp;
vec_set(temp, camera.x);
temp.z += 600;
effect(effect_fire, maxv(1, integer(RAIN_COUNT*time_step)), temp, nullvector);
wait(1);
}
} as for the lifespan, try to adapt it to your needs. i wasn't sure what you were trying to achieve so i just made the particle kind of like rain. i haven't tested the code. some general tips: try to write more compact code. try not to mix stuff which does the same thing (such as set and .flags) - just stick to one which fits your needs. don't mix English and German in variable names, use "const" for constants and write them in large letters. structurize your code with empty lines. and of course: "if you can say it with code, code, else comment" (which means that unnecessary comments don't add to the clearness of your code). joey.
|
|
|
|