CLEAR ALL
TYPE Snowflake
    FIELD x,y,d
END TYPE
BITMAP 1 TEXTURE "particle","64" RESCALE 10,10
TARGET BITMAP 1
SWAP PIXELS RGB(0,0,0),0
n=256
DIM sf(n) AS Snowflake
FOR i=1 TO n
    sf(i).x=RANGE(0,WINDOW.WIDTH)
    sf(i).y=RANGE(0,WINDOW.HEIGHT)
    sf(i).d=RANGE(3,8)
    c=RANGE(160,255)
    SPRITE i BIND BITMAP 1 SHOW MOVE x,y PRIORITY -1 TINT RGB(c,c,c,c)
NEXT i
SCREEN 5
h=400
WHEN TIMER 1
    IF h>200 THEN h=h-1
    INK RGB(240,240,240)
    RECT FILL 0,h,639,399
END WHEN
TIMER 1 ON EVERY 1000
DO
    FOR i=1 TO n
        x=sf(i).x
        y=sf(i).y+sf(i).d
        IF y>WINDOW.HEIGHT THEN
            x=RANGE(0,WINDOW.WIDTH)
            y=0
            sf(i).x=x
            sf(i).y=y
            sf(i).d=RANGE(3,8)
        ELSE
            sf(i).y=y
        END IF
        SPRITE i MOVE x,y
    NEXT i
    PAUSE
LOOP WHILE INKEY$=""
