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 |