% Blizzard dependant upon the mouse movement/placement
View.Set ("offscreenonly,nobuttonbar")
type flakes :
record
x : int % [x] position
y : int % [y] position
dX : int % Direction [x]
size : int % Size of snow flake [1,2, or 3]
end record
var fCount : int := 800 % Change to set the number of snowflakes
var mX, mY, mB : int := 0 % Mouse Coordinates
var snow : array 1 .. fCount of flakes % Create the snowflakes
procedure RandomizeValues (count : int)
snow (count).x := Rand.Int (-300, maxx + 300) % Randomize the position [x]
snow (count).y := Rand.Int (maxy, maxy + 200) % Randomize the position [y]
snow (count).size := Rand.Int (1, 3) % Randomize the size of the snowflake
snow (count).dX := Rand.Int (-3,3) % Randomize the direction of the snowflake
end RandomizeValues
% Initialize values
for i : 1 .. fCount
RandomizeValues (i) % Randomize the values for each snow flake
end for
loop
Draw.FillBox (0, 0, maxx, maxy, 7)
for i : 1 .. fCount
Mouse.Where (mX, mY, mB)
snow (i).x += snow (i).dX + (mX - maxx div 2) div 150 * snow (i).size % Move the snowflake in its [x] direction
snow (i).y -= snow (i).size*2 % Move the snowflake downward
Draw.FillOval (snow (i).x, snow (i).y, snow (i).size, snow (i).size, 25+snow(i).size*2) % Draw the snow flake
if snow (i).y < 0 then % If the snowflake has reached the ground
RandomizeValues (i) % Start it over
end if
end for
View.Update
end loop |