// Some old and ugly fireworks
 
SCREEN 640, 480, 16, 0
FrameLimit 40
Type pp
	Field x As Float
	Field y As Float
	Field a As Float
	Field l
	Field s As Float
	Field k
	Field r As Float
	Field g As Float
	Field b As Float
EndType
Repeat
	If Timer() - alku > lauk Then
		p.pp = New(pp)
		p\x = Rand(ScreenWidth())
		p\y = ScreenHeight()
		p\a = Rand(70, 110)
		p\l = Timer() + Rand(2000, 4000)
		p\s = Rnd(2.1, 4.4)
		p\r = Rand(100, 200) + 50
		p\g = Rand(100, 200) + 50
		p\b = Rand(100, 200) + 50
		alku = Timer()
		lauk = Rand(1, 1250)
	EndIf
	For p.pp = Each pp
		p\x = p\x + Cos(p\a) * p\s
		p\y = (p\y - Sin(p\a) * p\s) + gravity
		If p\r > 0 Or p\g > 0 Or p\b > 0 Then
			If p\k = 1 Then
				p\r = p\r - PI
				p\g = p\g - PI
				p\b = p\b - PI
			Else
				p\r = p\r - 1
				p\g = p\g - 1
				p\b = p\b - 1
			EndIf
		EndIf
		If p\k = 0 Then
			If Timer() - p\l > 0 Or p\x < 0 Or p\x > ScreenWidth() Or p\y < 0 Then
				num = Rnd(10, 20)
				For i = 0 To (360 / (num))
					ap.pp = New(pp)
					ap\x = p\x
					ap\y = p\y
					ap\a = i * num
					ap\l = Timer() + Rand(2000, 3000)
					ap\s = Rnd(0.2, 2.0)
					ap\k = 1
					ap\r = p\r
					ap\g = p\g
					ap\b = p\b
				Next i
				Delete p
			EndIf
		ElseIf Timer() - p\l > 0 And p\k = 1 Then
			Delete p
		EndIf
		For i = 1 To 5
			Color (p\r - (i * 2)) * ((p\r - (i * 2)) >= 0), (p\g - (i * 2)) * ((p\g - (i * 2)) >= 0), (p\b - (i * 2)) * (p\b - (i * 2) >= 0)
			Box p\x + Cos(180 + p\a) * i, p\y - Sin(180 + p\a) * i, 2, 2
		Next i
	Next p
	DrawScreen
Forever