Computer Science Canada Can someone help me. Its a beginner program. so ya |
Author: | Krocker [ Mon Nov 08, 2010 4:10 pm ] |
Post subject: | Can someone help me. Its a beginner program. so ya |
What is it you are trying to achieve? Trying to make stars flash at different places at random times What is the problem you are having? I got the stars to flash at different areas, but it also apears on my buildings and grassy areas. Describe what you have tried to solve this problem i treid to place it above the rest of tthe codings, but because it was a loop, it did not show te rest of the images Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) var x1,x2,y1,y2:int % opens splash screen View.Set ("nobuttonbar, position:center;center") colour (3) locate (12, 28) put "IMAGE BY KARANVEER BHARAJ" locate (10, 28) colour (red) put "PREPARED TO BE AMAZED!!!!!" delay (1000) cls % Landscape design setscreen ("graphics:max;max,nobuttonbar") % Creates the sky drawfillbox (0, 0, 1010, 700, black) % Draws the Grass drawfillbox (0, 0, 1010, 180, green) % Draws the moon drawfilloval (200, 550, 60, 60, white) drawfilloval (235, 570, 60, 60, black) % <=Black oval to give the moon a curve shape % Creates the clouds drawfilloval (200, 450, 95, 48, 24) % <= Clouds infront of the moon drawfilloval (150, 460, 100, 50, 24) drawfilloval (250, 450, 95, 48, 24) drawfilloval (290, 460, 100, 45, 24) drawfilloval (600, 500, 95, 48, 24) % <= Clouds behind the building drawfilloval (640, 480, 100, 50, 24) drawfilloval (685, 500, 95, 48, 24) drawfilloval (255, 470, 100, 45, 24) drawfilloval (980, 510, 95, 48, 24) % <= Clouds right of the building drawfilloval (1020, 490, 100, 50, 24) drawfilloval (1020, 530, 100, 50, 24) % Creates a white screen on the far left to cover 1/2 of the clouds drawfillbox (1300, 0, 1010, 900, white) % Create the Apartment drawfillbox (620, 180, 840, 500, grey) % Creates the Windows drawfillbox (650, 470, 690, 420, yellow) drawfillbox (710, 470, 750, 420, black) drawfillbox (770, 470, 810, 420, black) % <= 4th story windows drawfillbox (650, 400, 690, 350, black) drawfillbox (710, 400, 750, 350, yellow) drawfillbox (770, 400, 810, 350, black) % <= 3rd story windows drawfillbox (650, 330, 690, 280, yellow) drawfillbox (710, 330, 750, 280, yellow) drawfillbox (770, 330, 810, 280, black) % <= 2nd story windows drawfillbox (650, 230, 690, 190, yellow) % <= 1st story windows % Creates a door drawfillbox (710, 245, 810, 180, white) drawfillbox (710, 245, 712, 180, brown) % <= Door framing drawfillbox (810, 245, 808, 180, brown) drawfillbox (710, 245, 810, 243, brown) drawfillbox (760, 242, 760, 180, black) % <= Door separation drawfilloval (750, 208, 2, 2, black) % <= left door knob drawfilloval (770, 208, 2, 2, black) % <= right door knob % Creates the chimney drawfillbox (630, 500, 650, 512, 29) % <= Creates the base if the chimney drawline (620, 500, 840, 500, 26) % <= Creates a line at the base to separate the apartment and the chimney drawfilloval (640, 512, 15, 3, 29) drawoval (640, 512, 15, 3, 28) % Creates the tree trunk drawfillbox (200, 180, 215, 300, brown) % Creates the leafs of the tree drawfilloval (210, 310, 65, 50, green) drawfilloval (220, 310, 65, 50, green) drawfilloval (190, 310, 65, 50, green) % draws the indoor parkinglot drawfillbox (410, 180, 610, 300, 15) % <= building structure drawfillbox (430, 275, 590, 295, black) % <= Layers starting from top drawfillbox (430, 245, 590, 270, black) drawfillbox (430, 215, 590, 240, black) drawfillbox (480, 185, 590, 210, black) drawfillbox (430, 180, 475, 210, black) % <= Creates the garage's door drawfillbox (469, 180, 472, 190, 15) % <= Creates the gate mechanism for the entrance drawfillbox (445, 186, 469, 184, yellow) % <= Creates the gate lever for the entrance % Creates stars in the sky loop randint (x1, 1, 1200) randint (y1, 1, 800) randint (x2, 1, 1200) randint (y2, 1, 800) drawfillstar (x1, y1, x1 + 5, y1 + 5, white) drawfillstar (x2, y2, x2 + 5, y2 + 5, white) delay (50) drawfillstar (x1, y1, x1 + 5, y1 + 5, black) drawfillstar (x2, y2, x2 + 5, y2 + 5, black) end loop Please specify what version of Turing you are using 4.1 |
Author: | wooo00oo [ Wed Nov 10, 2010 8:03 pm ] |
Post subject: | Re: Can someone help me. Its a beginner program. so ya |
Try changing the code in the loop so that it only draws the stars if they are not over the building, grass, etc. by checking the x and y values. |
Author: | ScottD [ Mon Nov 15, 2010 10:19 pm ] | ||
Post subject: | RE:Can someone help me. Its a beginner program. so ya | ||
Just changed the x, y so that it wasn't below the building line, can be changed further to allow stars only before/after but you would need a new drawfillstar line. |
Author: | Grim [ Tue Nov 16, 2010 9:30 am ] |
Post subject: | RE:Can someone help me. Its a beginner program. so ya |
You could use whatdotcolour to ensure that if the stars are not on the sky they are cleared. |