Computer Science Canada Christmas Scene |
Author: | Kardaron [ Mon Jan 12, 2009 1:35 pm ] | ||
Post subject: | Christmas Scene | ||
I need help, for some reason, this program doesn't work on Turing 4.0.5 |
Author: | Insectoid [ Mon Jan 12, 2009 2:05 pm ] |
Post subject: | RE:Christmas Scene |
Why not show us the error message? Most of us are too lazy to actually run it. |
Author: | The_Bean [ Mon Jan 12, 2009 3:11 pm ] | ||||
Post subject: | Re: Christmas Scene | ||||
You have an opened ended drawline with what appears to be the ending of a for statement. This will not work in any version of turing that I know of.
You never declared 'i' |
Author: | andrew. [ Mon Jan 12, 2009 4:27 pm ] |
Post subject: | RE:Christmas Scene |
Actually, i was declared because it was in a for loop and the counter was called i. When you finish that drawline that wasn't ended, the program works. You should really look into View.Update to get rid of the flickering though. |
Author: | belarussian [ Wed Nov 18, 2009 9:27 pm ] |
Post subject: | RE:Christmas Scene |
want a good snow scene this is one of my old ones so everybody should know this is mine View.Set ("graphics:800;600,nobuttonbar,nocursor,noecho") View.Set ("offscreenonly") %set up the snow const NoOfFlakes := 400 var flakeX : array 1 .. NoOfFlakes of int var flakeY : array 1 .. NoOfFlakes of int for flake : 1 .. NoOfFlakes flakeX (flake) := Rand.Int (0, maxx) flakeY (flake) := Rand.Int (0, maxy) end for loop %Make the background Draw.FillBox (0, 0, 800, 300, 29) Draw.FillBox (0, 300, 800, 600, blue) %snowman %body Draw.FillOval (100, 110, 60, 60, white) Draw.FillOval (100, 195, 45, 45, white) Draw.FillOval (100, 260, 27, 27, white) %eyes Draw.FillOval (110, 270, 5, 5, black) Draw.FillOval (90, 270, 5, 5, black) %nose Draw.Line (105, 263, 95, 263, 42) Draw.Line (100, 250, 95, 263, 42) Draw.Line (100, 250, 105, 263, 42) Draw.Line (100, 250, 104, 263, 42) Draw.Line (100, 250, 103, 263, 42) Draw.Line (100, 250, 102, 263, 42) Draw.Line (100, 250, 101, 263, 42) Draw.Line (100, 250, 100, 263, 42) Draw.Line (100, 250, 99, 263, 42) Draw.Line (100, 250, 98, 263, 42) Draw.Line (100, 250, 97, 263, 42) Draw.Line (100, 250, 96, 263, 42) %mouth Draw.Line (105, 245, 95, 245, black) Draw.Arc (100, 245, 5, 5, 180, 0, black) %Hand Draw.FillOval (60, 195, 25, 20, white) Draw.FillOval (140, 195, 25, 20, white) %Flag Draw.ThickLine (155, 185, 155, 260, 2, black) var picID : int var x, y : int picID := Pic.FileNew ("images1.JPG") for i : 1 .. 50 x := 156 % Random x y := 210 % Random y Pic.Draw (picID, x, y, picCopy) end for Pic.Free (picID) %Hat Draw.ThickLine (127, 287, 73, 287, 3, black) Draw.ThickLine (127, 291, 73, 291, 4, white) Draw.ThickLine (127, 294, 73, 294, 3, black) Draw.ThickLine (129, 287, 129, 294, 2, black) Draw.ThickLine (73, 287, 73, 294, 2, black) Draw.FillBox (80, 294, 120, 330, black) %Buttons Draw.FillOval (100, 165, 5, 5, black) Draw.FillOval (100, 185, 5, 5, black) Draw.FillOval (100, 205, 5, 5, black) Draw.FillOval (100, 225, 5, 5, black) %sky %Moon Draw.FillOval (65, 550, 40, 40, yellow) Draw.FillOval (89, 556, 45, 45, blue) %stars Draw.FillStar (300, 500, 310, 510, yellow) Draw.FillStar (265, 465, 255, 455, yellow) Draw.FillStar (400, 550, 410, 540, yellow) Draw.FillStar (200, 510, 210, 520, yellow) Draw.FillStar (115, 550, 125, 560, yellow) Draw.FillStar (375, 485, 365, 475, yellow) Draw.FillStar (65, 480, 75, 490, yellow) Draw.FillStar (130, 420, 140, 410, yellow) Draw.FillStar (750, 550, 760, 560, yellow) %Big Bear Draw.FillStar (690, 455, 700, 465, yellow) Draw.FillStar (720, 430, 730, 440, yellow) Draw.FillStar (700, 400, 710, 410, yellow) Draw.FillStar (670, 405, 680, 415, yellow) Draw.FillStar (630, 380, 640, 390, yellow) Draw.FillStar (605, 350, 615, 360, yellow) Draw.FillStar (600, 320, 610, 330, yellow) %Draw.FillStar (500, 500, 490, 490, yellow) %Polar Draw.FillStar (530, 550, 545, 565, yellow) %Small Bear Draw.FillStar (510, 530, 500, 520, yellow) Draw.FillStar (495, 500, 485, 490, yellow) Draw.FillStar (490, 470, 480, 460, yellow) Draw.FillStar (490, 430, 480, 420, yellow) Draw.FillStar (460, 475, 450, 465, yellow) Draw.FillStar (460, 430, 450, 420, yellow) %Christamas tree %Trunk Draw.FillBox (380, 100, 420, 170, 113) %Leaves? Draw.Line (300, 170, 500, 170, green) Draw.Line (300, 170, 380, 250, green) Draw.Line (500, 170, 420, 250, green) Draw.Line (320, 250, 380, 250, green) Draw.Line (420, 250, 480, 250, green) Draw.Line (320, 250, 380, 310, green) Draw.Line (480, 250, 420, 310, green) Draw.Line (380, 310, 340, 310, green) Draw.Line (420, 310, 460, 310, green) Draw.Line (340, 310, 380, 350, green) Draw.Line (460, 310, 420, 350, green) Draw.Line (420, 350, 440, 350, green) Draw.Line (380, 350, 360, 350, green) Draw.Line (400, 390, 360, 350, green) Draw.Line (400, 390, 440, 350, green) Draw.Fill (400, 200, brightgreen, green) %star Draw.FillStar (380, 385, 420, 425, 40) %presents %#1 Draw.FillBox (340, 100, 370, 130, brightred) Draw.Line (340, 105, 365, 130, green) Draw.Line (345, 100, 370, 125, green) Draw.Line (340, 100, 340, 105, green) Draw.Line (340, 100, 345, 100, green) Draw.Line (370, 130, 365, 130, green) Draw.Line (370, 130, 370, 125, green) Draw.Fill (360, 120, green, green) %#2 Draw.FillBox (330, 100, 290, 130, brightgreen) Draw.Line (290, 105, 325, 130, brightpurple) Draw.Line (295, 100, 330, 125, brightpurple) Draw.Line (290, 100, 290, 105, brightpurple) Draw.Line (290, 100, 295, 100, brightpurple) Draw.Line (325, 130, 330, 130, brightpurple) Draw.Line (330, 130, 330, 125, brightpurple) Draw.Fill (310, 115, brightpurple, brightpurple) %Home Draw.Arc (650, 275, 220, 220, 240, 300, black) Draw.ThickLine (760, 85, 620, 360, 2, black) Draw.ThickLine (540, 85, 650, 360, 2, black) Draw.ThickLine (590, 65, 642, 200, 2, black) Draw.ThickLine (712, 65, 642, 200, 2, black) Draw.Fill (642, 100, 43, black) Draw.Fill (642, 210, 114, black) Draw.Arc (650, 275, 220, 220, 255, 285, 43) Draw.Arc (650, 274, 220, 220, 255, 285, 43) %person %Draw.FillOval for flake : 1 .. NoOfFlakes %Drop The Flake flakeY (flake) -= Rand.Int (1, 5) %flakeX (flake) += Rand.Int (-1, 1) if flakeY (flake) < 0 then flakeY (flake) := maxy flakeX (flake) := Rand.Int (0, maxx) end if Draw.FillOval (flakeX (flake), flakeY (flake), 1, 1, white) end for %Update the screen (because of offscreen only) View.Update delay (25) end loop |