' !!! FBSL BASIC !!!
#Option Implicit
#Include "mingfx.inc"
width = 640
height = 480
ns = 200: nf = width \ 40
delay = 0.4
red = LoadSprite("sprite\e5x.bmp", 480, 96, 5)
grn = LoadSprite("sprite\c5x.bmp", 480, 96, 5)
blu = LoadSprite("sprite\b5x.bmp", 480, 96, 5)
Dim stars[0 To ns, 0 To 1]
For i = 0 To ns
stars[i, 0] = Rnd() * width
stars[i, 1] = Rnd() * height
Next
Dim %z[nf], zx[nf], zy[nf]
Dim %b[nf], bx[nf], by[nf]
Dim %c[nf], cx[nf], cy[nf]
For i = 0 To nf
z [i] = Rnd() * 4: b[i] = Rnd() * 4: c[i] = Rnd() * 4
zx[i] = Rnd() * (width - 128): bx[i] = Rnd() * (width - 128): cx[i] = Rnd() * (width - 128)
zy[i] = Rnd() * (height - 128): by[i] = Rnd() * (height - 128): cy[i] = Rnd() * (height - 128)
Next
Window(width, height, FALSE, "Peter's Fireworks")
Animate
Screen(0, 0, 0)
For j = 0 To ns
Ink(j + 55, j + 55, j + 55)
FillCircle(stars[j, 0], stars[j, 1], 4)
Next
For i = 0 To nf
DrawSprite(red, zx[i], zy[i], 128, 128, z[i])
DrawSprite(grn, bx[i], by[i], 128, 128, b[i])
DrawSprite(blu, cx[i], cy[i], 128, 128, c[i])
Next
If Incr(delay, 0.1) > 0.4 Then
delay = 0.0
For i = 0 To nf
z[i] = z[i] + 1
b[i] = b[i] + 1
c[i] = c[i] + 1
If z[i] = 5 Then
z [i] = 0
zx[i] = Rnd() * (width - 128)
zy[i] = Rnd() * (height - 128)
End If
If b[i] = 5 Then
b [i] = 0
bx[i] = Rnd() * (width - 128)
by[i] = Rnd() * (height - 128)
End If
If c[i] = 5 Then
c [i] = 0
cx[i] = Rnd() * (width - 128)
cy[i] = Rnd() * (height - 128)
End If
Next
End If
Message(width \ 2 - 100, 8, 14, "RGB FIREWORK", &HFFFFFF)
Redraw()
Wait(10)
Forever