
-----------------------------------
AsianSensation
Wed Mar 10, 2004 10:53 pm

[Source] Snow
-----------------------------------
it seems alot of people have been as been wanting to do a snowfall program. Here are the three made by me, Mazer, and me in that order.

View.Set ("offscreenonly")
colorback (blue)
cls

type SnowType :
    record
        X, Y, Spd, Size : int
    end record

var Snow : array 1 .. 100 of SnowType

for rep : 1 .. 100
    Snow (rep).X := Rand.Int (5, 645)
    Snow (rep).Y := Rand.Int (5, 475)
    Snow (rep).Spd := Rand.Int (1, 3)
    Snow (rep).Size := Snow (rep).Spd
end for

loop
    for rep : 1 .. 100
        Snow (rep).Y -= Snow (rep).Spd
        if Snow (rep).Y < Snow (rep).Size then
            Snow (rep).Y := Rand.Int (475, 575)
        end if
        drawfilloval (Snow (rep).X, Snow (rep).Y, Snow (rep).Size, Snow (rep).Size, white)
    end for
    View.Update
    cls
end loop 



var win := Window.Open ("graphics:600;400,nobuttonbar,offscreenonly")
colourback (7)

var snowx, snowy, velx, vely : array 1 .. 75 of int

for i : 1 .. 75
    snowx (i) := Rand.Int (0, maxx + 400)
    snowy (i) := Rand.Int (0, maxy)
    velx (i) := Rand.Int (2, 4)
end for

loop
    exit when hasch
    for i : 1 .. 75
        drawfilloval (snowx (i), snowy (i), velx (i) div 2, velx (i) div 2, 0)
        snowx (i) -= velx (i)
        snowy (i) -= 4

        if snowy (i) < 0 or snowx (i) < 0 then
            snowx (i) := Rand.Int (0, maxx + 400)
            snowy (i) := maxy
        end if
    end for
    View.Update
    delay (25)
    cls
end loop

Window.Close (win)

View.Set ("offscreenonly")
colorback (black)
cls

var size : int := 200
var counter : real := 0
var t1 := Time.Elapsed
var d := 1

type SnowType :
    record
        X, Y, Spd, Size : real
    end record

var Snow : array 1 .. size of SnowType

for rep : 1 .. size
    Snow (rep).X := Rand.Int (0, maxx)
    Snow (rep).Y := Rand.Int (0, maxy)
    Snow (rep).Spd := Rand.Real * Rand.Int (1, 3)
    Snow (rep).Size := Snow (rep).Spd
end for

loop
    for rep : 1 .. size
        Snow (rep).Y -= Snow (rep).Spd
        Snow (rep).X += counter
        if Snow (rep).Y < 0 then
            Snow (rep).Y := Rand.Int (maxy, maxy + 100)
        end if
        if Snow (rep).X > maxx then
            Snow (rep).X := Rand.Int (-10, 0)
        end if
        if Snow (rep).X < 0 then
            Snow (rep).X := Rand.Int (maxx, maxx + 100)
        end if
        drawfilloval (round (Snow (rep).X), round (Snow (rep).Y), round (Snow (rep).Size), round (Snow (rep).Size), white)
    end for
    counter += d * 0.05

    if counter < 2 and counter > -2 then
        t1 := Time.Elapsed
    end if

    if (Time.Elapsed - t1) > 2000 and (counter >= 10 or counter 