AppTitle "Hail" Graphics 640, 480, 16, 2 SeedRnd MilliSecs() Type Obj Field X#, Y#, ID, D# End Type Global wind# = 0, windD = Rand(0, 1) Global imgBack = CreateImage(640, 440) SetBuffer ImageBuffer(imgBack) tmpC1 = 0: tmpC2 = 0: tmpC3 = 0 For i = 0 To 440 Step 20 Color tmpC1, tmpC2, tmpC3 Rect 0, i, 640, 20, 1 tmpC1 = tmpC1 + 4: tmpC2 = tmpC2 + 4: tmpC3 = tmpC3 + 8 Next Global imgSqr = CreateImage(128, 128) SetBuffer ImageBuffer(imgSqr) Color 128, 255, 255 Rect 0, 0, 128, 128, 1 SetBuffer BackBuffer() While Not KeyDown(1) o.Obj = New Obj r# = Rnd(2, 6) o\X = Rand(-80, 720) o\Y = -(r) o\D = r DrawImage imgBack, 0, 0 Color 255, 255, 255 Rect 0, 440, 640, 40, 1 DrawImage imgSqr, 320 - 64, 440 - 128 For o.Obj = Each Obj tmpDel = 0 Oval o\X, o\Y, o\D, o\D, 1 o\X = o\X + wind# o\Y = o\Y + o\D * 1.5 If o\Y >= 440 Then tmpDel = 1 Else If ImageRectCollide(imgSqr, 320 - 64, 440 - 128, 0, o\X, o\Y, o\D, o\D) Then tmpDel = 1 SetBuffer ImageBuffer(imgSqr) Color 0, 0, 0 Oval o\X - (320 - 64), o\Y - (440 - 128), o\D * 2, o\D * 2 Color 255, 255, 255 SetBuffer BackBuffer() EndIf EndIf If tmpDel = 1 Then Delete o Next If windD = 0 Then If wind > -2 Then wind = wind - .01 Else windD = 1 Else If wind < 2 Then wind = wind + .01 Else windD = 0 EndIf If Rand(1, 20) = 10 Then If windD = 0 Then windD = 1 Else windD = 0 EndIf Text 1, 1, "Wind: " + Left$(Str(wind), 4) Flip: Cls Wend: End