Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
explosion (particle effects)
Author Message
AsianSensation

Posted: Tue May 20, 2003 8:15 pm   Post subject: explosion (particle effects)

The weapons almost done for my game, now all I need is some nice explosion effects. After reading Catalyst's code for the exploding text(which I am still kinda confused about ) I was wondering how would you color and shade the particles so it looks like an explosion? I will take any suggestions, and any help from Catalyst is greatly appreciated.

Catalyst

Posted: Tue May 20, 2003 8:30 pm   Post subject: (No subject)

heres some old code of mine that makes an explosion it is simpler
if u want complete control my 2d particle engine would probably help its more complicated tho

 code: setscreen ("offscreenonly,graphics:640;640") randomize const numP := 800 const accel := 0.8 const maxLife := 510 var clr : int for i : 1 .. 255     clr := RGB.AddColor (1, i / 256, 0) end for drawfilloval (maxx div 2, maxy div 2 + 100, 10, 10, black) drawfillbox (maxx div 2-2,maxy div 2+110,maxx div 2+2,maxy div 2+115,black) drawline (maxx div 2,maxy div 2+115,maxx div 2,maxy div 2+125,15) drawfilloval (maxx div 2,maxy div 2+125,2,2,42) delay (1500) type part :     record         x : real         y : real         xV : real         yV : real         r : int         life : int     end record var main : array 1 .. numP of part var a : array 1 .. numP of int for i : 1 .. numP     main (i).x := maxx div 2     main (i).y := maxy div 2 + 100     main (i).xV := Rand.Int (-40, 40) * Rand.Real     main (i).yV := Rand.Int (-40, 41) * Rand.Real     main (i).r := Rand.Int (1, 8)     main (i).life := maxLife + Rand.Int (-100, 0)     a (i) := Rand.Int (28, 31) end for loop     for i : 1 .. numP         main (i).xV -= main (i).xV / 16         main (i).yV -= accel + main (i).yV / 16         main (i).x += main (i).xV         main (i).y += main (i).yV         main (i).life -= 10         if main (i).life >= 255 then             drawfilloval (round (main (i).x), round (main (i).y), main (i).r, main (i).r, round (((main (i).life / maxLife) * 255) + 255))         else             drawfilloval (round (main (i).x), round (main (i).y), main (i).r, main (i).r, a (i))         end if     end for     View.Update     cls end loop
Asok

Posted: Tue May 20, 2003 10:21 pm   Post subject: (No subject)

I'm doing explosions a cheaper way. essentially you have images of explosions (uncompressed game sprite files work wonders, see Half-Life) in a for loop drawing on top of eachother with a cls or a box drawing over it so it looks like it's actively exploding. It just depends for the type of effect you want, Catalyst's example would be if you needed the entire screen to blow up, my example would work better for a smaller portion of the screen.
Catalyst

Posted: Tue May 20, 2003 10:22 pm   Post subject: (No subject)

altho my effect is scalable
ur method woudl prob work better in the game situation since it would be faster and look better
Asok

Posted: Tue May 20, 2003 10:35 pm   Post subject: (No subject)

that's why I brought it up because he was working on a game. typically games already run slow due to a large amount of images on screen and background music/sfx so yours would slow down the game by alot.

by the way, for shits and gigles, I tested your effect in my game and it slowed to a crawl
naoki

Posted: Wed May 21, 2003 5:00 pm   Post subject: (No subject)

*notes the above*

dammit so that's why lag is so noticeable!
hello

Posted: Thu May 22, 2003 7:35 pm   Post subject: (No subject)

if it lags so much do u suggest turing created explosions over imported explosion pics?
Asok

Posted: Thu May 22, 2003 8:02 pm   Post subject: (No subject)

imported explosion pics, it'll run much more smoothly (it's what I'm using now)