
-----------------------------------
Schaef
Fri Jan 23, 2004 4:32 pm

explosion help
-----------------------------------
Im trying to make something explode for my school project but i dont know how to get a whole bunch of particles to go out in different directions at the sametime after I have drawn them.  I had the same problem with a cloud program i was doing.  I drew the cloud with a whole bunch of dots and I want all of the dots to move seperately but I didnt know how and i ended up moving the cloud with Pic.Draw .  If ne one could give me a code and explain how they did it it would be very helpful

-----------------------------------
Tony
Fri Jan 23, 2004 5:01 pm


-----------------------------------
there's a number of particle engines available... you just make a radial push force in the center of explosion

-----------------------------------
Cervantes
Fri Jan 23, 2004 5:02 pm


-----------------------------------
you could look at Kuntzy's blood particle program...

http://www.compsci.ca/v2/viewtopic.php?t=3150

Cheers

-----------------------------------
Schaef
Fri Jan 23, 2004 5:04 pm


-----------------------------------
i need a code of a program.  just a small explosion with little particles.  I have no idea how to create a particle engine.

-----------------------------------
Tony
Fri Jan 23, 2004 5:05 pm


-----------------------------------
you dont have to create, just borrow an existing one and give credit in your program

-----------------------------------
Schaef
Fri Jan 23, 2004 5:08 pm


-----------------------------------
lol.  I would like to know what I am doing so i can use it in different situations.  all of the particle programs seem to have "type" and "record" in the beginning of the program.  What do these mean?

-----------------------------------
Cervantes
Fri Jan 23, 2004 5:09 pm


-----------------------------------
ooh ooh! if you can't do it in Turing then you can always draw a series of pictures in Paint of your thing exploding and then import those into Turing :D:D

-----------------------------------
Schaef
Fri Jan 23, 2004 5:10 pm


-----------------------------------
i could.. but that would suck  :D . lol.  could someone just plz post a code and tell me how it works?

-----------------------------------
Cervantes
Fri Jan 23, 2004 5:11 pm


-----------------------------------
I would but I don't know how to do it either :think:

-----------------------------------
Schaef
Fri Jan 23, 2004 5:19 pm


-----------------------------------
lol.  does ne one know how i could do it.  I can make all of the little dots put then I cannot change the x and y values for each of them because if i do something like:

var x,y:int

for dots:1..1000
randint (x,100,200)
randint (y,200,300)
drawdot(x,y,16)
end for

could i move all of the dots in different directions instead of just taking a picture of the screen and moving the whole thing?

-----------------------------------
Schaef
Fri Jan 23, 2004 6:03 pm


-----------------------------------
can someone plz post an example for me?

-----------------------------------
AsianSensation
Fri Jan 23, 2004 6:06 pm


-----------------------------------
you should have searched.

here is Catalyst's 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

-----------------------------------
Schaef
Fri Jan 23, 2004 6:08 pm


-----------------------------------
ya i did search.  I found that one.  I am just not sure how "type" and "record" commands work..

-----------------------------------
AsianSensation
Fri Jan 23, 2004 6:12 pm


-----------------------------------
http://www.compsci.ca/v2/viewtopic.php?t=2325

dodge wrote it

-----------------------------------
Schaef
Fri Jan 23, 2004 6:19 pm


-----------------------------------
ok thx that is a really helpful tutorial

-----------------------------------
Kuntzy
Sun Jan 25, 2004 3:40 pm


-----------------------------------
If you use my particle engine, the engine is in a proccedure and the names of the arguments are pretty self explanitory.
