Smoke Bug?

Posted By: Dreher

Smoke Bug? - 04/25/09 20:53

Hello,

I'm using the smoke code from Aum60 (As it's exactly what I'm looking for), but there is something wrong with it!



Code:
function fade_smoke()

{

       my.alpha -= 0.15 * time; // particle fading speed

       if (my.alpha < 0) {my.lifespan = 0;}

}

 

function smoke_effect()

{
	    my.bmap = smoke;
	    
       temp.x = random(1) - 0.5; // move a bit on the x

       temp.y = random(1) - 0.5; // and y axis

       temp.z = random(2); // but always move upwards on the z axis

       vec_add (my.vel_x, temp);

       my.alpha = 10 + random(20);

       my.size = 5; // size of the smoke

       my.bright = on;

       my.move = on;

       my.lifespan = 50; // lifespan for the smoke particles

       my.function = fade_smoke;

}

 

starter generate_smoke()

{

       while (diamond == null) {wait (1);}

       while (1)

       {

               vec_for_vertex (temp, diamond, 2617); // generate smoke from the 246th vertex on the player model

               effect (smoke_effect, (2 / (time_step + 0.1)), temp.x, normal);

               wait (1);

       }

}


I can't think of something, it should work shocked
Posted By: EvilSOB

Re: Smoke Bug? - 04/25/09 21:53

It looks like something is wrong with your BMAP "smoke".
Ive not used this code, but I think the BMAP needs to have an
alpha channel (for transparency), like TGA for example.

The solid grey squares tells me something is wrong with the BMAP,
but their positions look OK.

Try using "smoke.tga" from the "x:/GStudio7/templates/images" folder of your install.
Posted By: Dreher

Re: Smoke Bug? - 04/25/09 22:14

Isn't gonne work..

Code:
BMAP* smoke_tga = "C\Program Files\GStudio7\template_6\images\smoke.tga";

function fade_smoke()

{

       my.alpha -= 0.15 * time; // particle fading speed

       if (my.alpha < 0) {my.lifespan = 0;}

}

function smoke_effect()

{
       my.bmap = smoke_tga;
	    
       temp.x = random(1) - 10.5; // move a bit on the x

       temp.y = random(1) - 10.5; // and y axis

       temp.z = random(2); // but always move upwards on the z axis

       vec_add (my.vel_x, temp);

       my.alpha = 10 + random(20);

       my.size = 5; // size of the smoke

       my.bright = on;

       my.move = on;

       my.lifespan = 50; // lifespan for the smoke particles

       my.function = fade_smoke;

}

starter generate_smoke()

{

       while (diamond == null) {wait (1);}

       while (1)

       {

               vec_for_vertex (temp, diamond, 2617); // generate smoke from the 246th vertex on the player model

               effect (smoke_effect, (2 / (time_step + 0.1)), temp.x, normal);

               wait (1);

       }

}

starter generate_smoke()

{

       while (diamond == null) {wait (1);}

       while (1)

       {
       	
               vec_for_vertex (temp, diamond, 2516); // generate smoke from the 246th vertex on the player model

               effect (smoke_effect, (2 / (time_step + 0.1)), temp.x, normal);

               wait (1);

       }

}


When trying to run, it says: (): Bitmap unkown C

BTW, I'm on XP ><
Posted By: ngisiger

Re: Smoke Bug? - 04/25/09 23:53

Hi!

I agree with EvilSOB (yikes! grin)

The code seems to work: it's just the aspect of the bitmap used as particle which is problematic.

Either the bitmap you use is somehow incorrect (YMCK or grayscale or indexed format, etc.) or A7 can't find it and uses a grey square instead of a bitmap (I think that's the default mode).

Maybe try copying the bitmap smoke.tga in the folder of your game, and rename smoke_tga accordingly.

Hope this helps!
Thomas
Posted By: Dreher

Re: Smoke Bug? - 04/26/09 01:01

Ok, I got it fixed, the code I use now (With the smoke.tga within the game folder)

Code:
BMAP smoke_tga = "smoke.tga";

function fade_smoke()

{

       my.alpha -= 0.15 * time; // particle fading speed

       if (my.alpha < 0) {my.lifespan = 0;}

}

 

function smoke_effect()

{
	    my.bmap = smoke_tga;
	    
       temp.x = random(1) - 0.5; // move a bit on the x

       temp.y = random(1) - 0.5; // and y axis

       temp.z = random(2); // but always move upwards on the z axis

       vec_add (my.vel_x, temp);

       my.alpha = 10 + random(20);

       my.size = 5; // size of the smoke

       my.bright = on;

       my.move = on;

       my.lifespan = 50; // lifespan for the smoke particles

       my.function = fade_smoke;

}

 

starter generate_smoke()

{

       while (diamond == null) {wait (1);}

       while (1)

       {

               vec_for_vertex (temp, diamond, 2617); // generate smoke from the 246th vertex on the player model

               effect (smoke_effect, (2 / (time_step + 0.1)), temp.x, normal);

               wait (1);

       }

}


I hope this will help other people out aswell ^^

And thanks to you too of course! wink
© 2024 lite-C Forums