Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 explosion help
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Schaef




PostPosted: Fri Jan 23, 2004 4:32 pm   Post subject: 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
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jan 23, 2004 5:01 pm   Post subject: (No subject)

there's a number of particle engines available... you just make a radial push force in the center of explosion
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Cervantes




PostPosted: Fri Jan 23, 2004 5:02 pm   Post subject: (No subject)

you could look at Kuntzy's blood particle program...

http://www.compsci.ca/v2/viewtopic.php?t=3150

Cheers
Schaef




PostPosted: Fri Jan 23, 2004 5:04 pm   Post subject: (No subject)

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




PostPosted: Fri Jan 23, 2004 5:05 pm   Post subject: (No subject)

you dont have to create, just borrow an existing one and give credit in your program
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Schaef




PostPosted: Fri Jan 23, 2004 5:08 pm   Post subject: (No subject)

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




PostPosted: Fri Jan 23, 2004 5:09 pm   Post subject: (No subject)

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 Very HappyVery Happy
Schaef




PostPosted: Fri Jan 23, 2004 5:10 pm   Post subject: (No subject)

i could.. but that would suck Very Happy . lol. could someone just plz post a code and tell me how it works?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Fri Jan 23, 2004 5:11 pm   Post subject: (No subject)

I would but I don't know how to do it either Thinking
Schaef




PostPosted: Fri Jan 23, 2004 5:19 pm   Post subject: (No subject)

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




PostPosted: Fri Jan 23, 2004 6:03 pm   Post subject: (No subject)

can someone plz post an example for me?
AsianSensation




PostPosted: Fri Jan 23, 2004 6:06 pm   Post subject: (No subject)

you should have searched.

here is Catalyst's code:

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




PostPosted: Fri Jan 23, 2004 6:08 pm   Post subject: (No subject)

ya i did search. I found that one. I am just not sure how "type" and "record" commands work..
AsianSensation




PostPosted: Fri Jan 23, 2004 6:12 pm   Post subject: (No subject)

http://www.compsci.ca/v2/viewtopic.php?t=2325

dodge wrote it
Schaef




PostPosted: Fri Jan 23, 2004 6:19 pm   Post subject: (No subject)

ok thx that is a really helpful tutorial
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: