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