Computer Science Canada smoke from chimmeney animation? |
Author: | revangrey [ Sat Jan 03, 2009 12:37 am ] |
Post subject: | smoke from chimmeney animation? |
I want to make smoke come out of a chimmeney continuously and dissapate at a certain point. What is the function for making the smoke dissappear? I am also unsure how to regenerate smoke... the most I could wrap my head around is moving the smoke up and down on the chimmeney; and say that it was smoking... As always, any and ALL help is greatly appreciated! thanks in advance! |
Author: | Homer_simpson [ Sat Jan 03, 2009 1:22 am ] |
Post subject: | Re: smoke from chimmeney animation? |
i'm now sure how familiar you are with object oriented programing, so here's a broad description: -assuming you are using ovals as particles of smoke, -make a variable type for them with x,y as integers -declare an array of up to 100(depending how much smoke particles u want) of this type -inside your main animation loop move the x and y of these particles accoringly -once particle y is bigger than maxy reset it to lower number |
Author: | Homer_simpson [ Sat Jan 03, 2009 1:50 am ] |
Post subject: | Re: smoke from chimmeney animation? |
i was bored so i made u a sample, particles can do fun things i hope u can learn from the code: Quote: View.Set ("offscreenonly,graphics:420;600")
const MaxParticles := 100 const startfirex := 100 const startfirey := 100 const smokelength := 300 type Particle_Type : %declare type record x, y : real end record var Particles : array 1 .. MaxParticles of Particle_Type %declare array of type that you've made for i : 1 .. MaxParticles % give particles their initial x,y value Particles (i).x := startfirex + Rand.Int (0, 20) %randmize the x position Particles (i).y := startfirey + Rand.Int (0, smokelength) %randmize the y position end for loop %main animation loop cls for i : 1 .. MaxParticles %inside this loop we go through all the particles 1 by 1 Particles (i).y += .4 %move up the smoke particle Particles (i).x += sind (Particles (i).y * 20) / (Rand.Int (3, 8)) % add a little wavy motion to the x value( erase the line to see what it does) if Particles (i).y >= smokelength + startfirey then %if particle has reach certain height reset its height back to the starting point Particles (i).y := startfirex end if drawfilloval (round (Particles (i).x), round (Particles (i).y), 15, 15, ((Particles (i).y - startfirey) div (smokelength / 15) + 16)) %draw the particle end for View.Update end loop |
Author: | revangrey [ Sat Jan 03, 2009 1:56 am ] |
Post subject: | Re: smoke from chimmeney animation? |
Thank you! +bits p.s. If you're really bored may I suggest Assasins Creed or Call of Duty 4? cuz it's almost 2 in the morning and I think we both live in Canada so ... thanks again! |
Author: | gagster1233 [ Wed Nov 04, 2009 5:48 pm ] |
Post subject: | Re: smoke from chimmeney animation? |
k i tried to put the smoke animation to my house image but it never shows up. can you help me? |