%Program to create a winter scene
%dwgb93
%November 20, 2008
setscreen ("graphics:800,600") %........................................Makes screen 800x600 and uses pixels for measurement
View.Set ("offscreenonly") %............................................Makes changes off screen, then puts them on to reduce flickering
var YOval, YOval1, YOval2, YOval3, YOval4, YOval5, x1, x2 : int
var counter : int
colorback (11) %.......................................................Background sky blue
cls %..................................................................Full screen
counter := 0
YOval := 275
YOval2 := 275
YOval3 := 275
YOval4 := 275
YOval5 := 275
x1 := 420
x2 := 430
procedure BackgroundPic %...............................................Makes the following a procedure (an image in this case)
drawfilloval (maxx div 2, -15, maxx, maxy div 4, white) %..........Ground on hill is white
drawfilloval (maxx, maxy, 70, 70, yellow) %........................Sun in top right
drawline (700, 600, 730, 580, black) %.............................Sun's rays
drawline (730, 580, 710, 550, black) %.............................Sun's rays
drawline (710, 550, 748, 548, black) %.............................Sun's rays
drawline (748, 548, 750, 510, black) %.............................Sun's rays
drawline (750, 510, 780, 530, black) %.............................Sun's rays
drawline (780, 530, 800, 500, black) %.............................Sun's rays
drawline (800, 500, 800, 529, black) %.............................Sun's rays
drawoval (maxx, maxy, 70, 70, black) %.............................Sun outline
drawline (700, 600, 739, 600, black) %.............................Sun's rays
drawfill (749, 549, 42, black) %...................................Ray colour
drawfillbox (220, 50, 500, 200, 115) %.............................House
drawline (200, 200, 250, 250, black) %.............................Roof
drawline (250, 250, 470, 250, black) %.............................Roof
drawline (470, 250, 520, 200, black) %.............................Roof
drawline (200, 200, 520, 200, black) %.............................Roof
drawfill (360, 225, 115, black) %..................................Roof colour
drawfillbox (400, 250, 450, 300, 115) %............................Chimney
drawfillbox (390, 300, 460, 315, gray) %...........................Chimney
drawfillbox (360, 50, 410, 150, 114) %.............................Door
drawfillbox (355, 50, 360, 155, 116) %.............................Door frame
drawfillbox (355, 150, 415, 155, 116) %............................Door frame
drawfillbox (410, 50, 415, 155, 116) %.............................Door frame
drawfilloval (370, 100, 5, 5, gray) %..............................Door knob
drawfillbox (240, 100, 340, 160, 11) %.............................Window
drawfillbox (240, 128, 340, 132, black) %..........................Window frame
drawfillbox (266, 100, 270, 128, black) %..........................Window frame
drawfillbox (308, 100, 312, 128, black) %..........................Window frame
drawfillbox (430, 100, 490, 160, 11) %.............................Window
drawfillbox (430, 128, 490, 132, black) %..........................Window frame
drawfillbox (458, 100, 462, 160, black) %..........................Window frame
drawarc (0, 250, 216, 135, 289, 339, black) %.......................Creates ramp
drawarc (maxx div 2, -15, maxx, maxy div 4, 103, 115, black) %......Outlines ground
drawdot (219, 130, black) %.........................................Cover up wierd pixel
drawline (220, 130, 220, 200, black) %..............................Line up house
drawfill (215, 190, 30, black) %....................................Fills ramp
drawfilloval (100, 100, 50, 50, white) %...........................Snowman's base
drawoval (100, 100, 50, 50, black) %...............................Snowman outline
drawfilloval (100, 150, 40, 40, white) %...........................Snowman's body
drawoval (100, 150, 40, 40, black) %...............................Snowman outline
drawfilloval (100, 100, 49, 49, white) %...........................Erases black line
drawfilloval (100, 200, 30, 30, white) %...........................Snowman's head
drawoval (100, 200, 30, 30, black) %...............................Snowman outline
drawfilloval (100, 150, 39, 39, white) %...........................Erases black line
drawfilloval (100, 160, 5, 5, black) %.............................Snowman's top button
drawfilloval (100, 130, 5, 5, black) %.............................Snowman's middle button
drawfilloval (100, 100, 5, 5, black) %.............................Snowman's bottom button
drawfilloval (100, 180, 25, 5, brightred) %........................Snowman's scarf
drawfilloval (100, 185, 25, 5, white) %............................Erases top of scarf
drawfilloval (90, 210, 3, 3, black) %..............................Snowman's left eye
drawfilloval (110, 210, 3, 3, black) %.............................Snowman's right eye
drawline (100, 203, 125, 200, black) %.............................Snowman's nose
drawline (125, 200, 100, 197, black) %.............................Snowman's nose
drawline (100, 197, 100, 203, black) %.............................Snowman's nose
drawfill (105, 200, 42, black) %...................................Colours snowman's nose
drawfilloval (100, 185, 2, 2, black) %.............................Snowman's mouth
drawfilloval (113, 190, 2, 2, black) %.............................Snowman's mouth
drawfilloval (87, 190, 2, 2, black) %..............................Snowman's mouth
drawfilloval (93, 186, 2, 2, black) %..............................Snowman's mouth
drawfilloval (107, 186, 2, 2, black) %.............................Snowman's mouth
drawfilloval (100, 225, 30, 5, black) %............................Hat brim
drawline (90, 225, 90, 250, black) %...............................Hat left
drawline (110, 225, 110, 250, black) %.............................Hat right
drawfilloval (100, 250, 10, 2, black) %............................Hat top
drawfill (100, 240, black, black) %................................Hat colour
drawline (60, 150, 25, 160, black) %................................Snowman's arm
drawline (140, 150, 175, 160, black) %..............................Snowman's arm
drawline (25, 160, 15, 170, black) %................................Snowman's finger
drawline (25, 160, 10, 160, black) %................................Snowman's finger
drawline (25, 160, 15, 150, black) %................................Snowman's finger
drawline (175, 160, 190, 170, black) %..............................Snowman's finger
drawline (175, 160, 195, 160, black) %..............................Snowman's finger
drawline (175, 160, 190, 150, black) %..............................Snowman's finger
drawfillbox (630, 50, 680, 100, 115) %.............................Tree trunk
drawarc (625, 290, 30, 70, 270, 0, black) %........................Tree top layer left
drawarc (685, 290, 30, 70, 180, 270, black) %......................Tree top layer right
drawline (625, 220, 685, 220, black) %.............................Tree top layer bottom
drawfill (655, 270, green, black) %................................Tree top layer colour
drawarc (610, 250, 40, 60, 270, 331, black) %......................Tree fourth layer left
drawarc (700, 250, 40, 60, 212, 270, black) %......................Tree fourth layer right
drawline (610, 190, 700, 190, black) %.............................Tree fourth leyer bottom
drawfill (655, 210, brightgreen, black) %..........................Tree fourth layer colour
drawarc (590, 210, 50, 50, 270, 338, black) %......................Tree treprd layer left
drawarc (720, 210, 50, 50, 205, 270, black) %......................Tree treprd layer right
drawline (590, 160, 720, 160, black) %.............................Tree treprd layer bottom
drawfill (655, 180, green, black) %................................Tree treprd layer colour
drawarc (560, 180, 80, 50, 270, 338, black) %......................Tree second layer left
drawarc (750, 180, 80, 50, 205, 270, black) %......................Tree second layer right
drawline (560, 130, 750, 130, black) %.............................Tree second layer bottom
drawfill (655, 150, brightgreen, black) %..........................Tree second layer colour
drawline (530, 100, 780, 100, black) %.............................Bottom of tree
drawarc (530, 150, 100, 50, 270, 336, black) %.....................Tree bottom left
drawarc (780, 150, 100, 50, 205, 270, black) %.....................Tree bottom right
drawfill (655, 125, green, black) %................................Tree bottom layer colour
drawdot (621, 129, green) %........................................Cover up wierd pixel
drawdot (621, 130, black) %........................................Cover up wierd pixel
drawdot (634, 161, green) %........................................Cover up wierd pixel
drawdot (636, 191, brightgreen) %..................................Cover up wierd pixel
drawdot (645, 221, green) %........................................Cover up wierd pixel
drawfillstar (640, 270, 670, 300, yellow) %........................Star on tree
end BackgroundPic %....................................................Indicates the end of the procedure
type Snowing : %.......................................................The name of the record
record %...........................................................Indicates the following will be a record
x : int %......................................................Integer variable (x coordinate of snowflake)
y : int %......................................................Integer variable (y coordinate of snowflake)
speed : int %..................................................Integer variable (speed of snowflake)
size : int %...................................................Integer variable (size of snowflake)
xchange : int
direction : int %..............................................Integer variable (direction snowflake travels)
end record %.......................................................Indicates the end of the record
var snow : array 1 .. 100 of Snowing %.................................Creating an array of the record snowing from 1-100
for rep : 1 .. 100 %...................................................For loop for each part of the the array
randint (snow (rep).x, 0, maxx) %..................................Random integer of the loop of the array which gives a value to the x coordinate of a snowflake
randint (snow (rep).y, maxy, maxy + 100) %.........................Random integer of the loop of the array which gives a value to the y coordinate of a snowflake
randint (snow (rep).size, 1, 3) %..................................Random integer of the loop of the array which gives a value to the sixe of a snowflake
randint (snow (rep).speed, -3, -1) %...............................Random integer of the loop of the array which gives a value to the speed of a snowflake
randint (snow (rep).xchange, -3, 3)
randint (snow (rep).direction, -3, 3) %............................Random integer of the loop of the array which gives a value to the direction of a snowflake
end for %..............................................................Ends the for loop
loop
for i : 0 .. 100
drawfillbox (375 + i, 35 + i, 400 + i, 85 + i, black)
drawline (400 + i, 85 + i, 395 + i, 125 + i, black)
drawarc (300 + i, 50 + i, 150, 100, 18, 50, black)
drawfillarc (400 + i, 60 + i, 75, 25, 270, 90, black)
drawarc (375 + i, 75 + i, 10, 10, 90, 180, black)
drawarc (355 + i, 75 + i, 10, 10, 270, 0, black)
drawline (365 + i, 75 + i, 365 + i, 77 + i, black)
drawfillbox (305 + i, 35 + i, 355 + i, 65 + i, black)
drawarc (305 + i, 70 + i, 5, 5, 180, 270, black)
drawline (300 + i, 70 + i, 300 + i, 80 + i, black)
drawarc (295 + i, 80 + i, 5, 5, 0, 90, black)
drawline (295 + i, 85 + i, 280 + i, 85 + i, black)
drawarc (280 + i, 80 + i, 5, 5, 90, 180, black)
drawline (275 + i, 80 + i, 275 + i, 40 + i, black)
drawarc (280 + i, 40 + i, 5, 5, 180, 270, black)
drawline (280 + i, 35 + i, 375 + i, 35 + i, black)
drawfill (290 + i, 50 + i, black, black)
drawfill (360 + i, 50 + i, black, black)
drawline (300 + i, 35 + i, 280 + i, 15 + i, black)
drawfilloval (284 + i, 12 + i, 5, 5, black)
drawline (286 + i, 7 + i, 350 + i, 7 + i, black)
drawfilloval (352 + i, 12 + i, 5, 5, black)
drawfilloval (318 + i, 12 + i, 5, 5, black)
drawline (355 + i, 8 + i, 382 + i, 35 + i, black)
drawline (276 + i, 36 + i, 270 + i, 10 + i, black)
drawfillbox (415 + i, 35 + i, 420 + i, 15 + i, black)
drawfillbox (375 + i, 10 + i, 450 + i, 15 + i, black)
drawarc (450 + i, 25 + i, 50, 15, 270, 10, black)
drawarc (450 + i, 30 + i, 50, 15, 270, 350, black)
drawarc (485 + i, 25 + i, 15, 10, 0, 229, black)
drawdot (475 + i, 17 + i, black)
drawfill (455 + i, 12 + i, black, black)
end for
counter += 1
drawfilloval (x1, YOval, 10, 10, darkgray)
drawfilloval (x2, YOval2, 10, 10, darkgray)
drawfilloval (x1, YOval3, 10, 10, darkgray)
drawfilloval (x2, YOval4, 10, 10, darkgray)
drawfilloval (x1, YOval5, 10, 10, darkgray)
YOval += 1
if counter > 15 then
YOval2 += 1
end if
if counter > 30 then
YOval3 += 1
end if
if counter > 45 then
YOval4 += 1
end if
if counter > 60 then
YOval5 += 1
end if
if YOval > maxy + 10 then
YOval := 275
end if
if YOval2 > maxy + 10 then
YOval2 := 275
end if
if YOval3 > maxy + 10 then
YOval3 := 275
end if
if YOval4 > maxy + 10 then
YOval4 := 275
end if
if YOval5 > maxy + 10 then
YOval5 := 275
end if
BackgroundPic
for rep : 1 .. 100 %.................................................
drawfilloval (snow (rep).x, snow (rep).y, snow (rep).size, snow (rep).size, white)
snow (rep).x += snow (rep).direction
snow (rep).x += snow (rep).xchange
snow (rep).y += snow (rep).speed
if snow (rep).y <= 50 then
randint (snow (rep).x, 0, maxx)
randint (snow (rep).y, maxy, maxy) % + 100)
randint (snow (rep).size, 1, 3)
randint (snow (rep).speed, -3, -1)
randint (snow (rep).direction, -3, 3)
randint (snow (rep).xchange, -3, 3)
end if
snow (rep).x += snow (rep).direction
snow (rep).x += snow (rep).xchange
snow (rep).y += snow (rep).speed
if snow (rep).x <= 0 then
snow (rep).x := maxx
elsif snow (rep).x >= maxx then
snow (rep).x := 0
end if
end for
View.Update
cls
BackgroundPic
end loop
|