Computer Science Canada What is the problem with this program?? |
Author: | Hannah [ Sat Jan 07, 2006 2:33 pm ] |
Post subject: | What is the problem with this program?? |
Quote: var dot : int var col : int View.Set ("offscreenonly") %Declares red, green and blue variables var r, g, b : int %Loop allows you where to draw the dots for x : 1 .. maxx for y : 1 .. 400 %Randomize red colour randint (r, 116, 146) %Randomize green color randint (g, 143, 170) %Radomize blue colour randint (b, 12, 23) %RBG Set colour program allows to you to mix the colours RGB.SetColour (2, r / 255.0, g / 255.0, b / 255.0) %draws randomized dots Draw.Line (x, y, x, y, 2) end for end for proc movcar drawfillbox (5, 100, 80, 150, 64) drawfillbox (75, 145, 80, 130, 68) drawfillbox (75, 120, 80, 105, 68) drawfillbox (12, 145, 50, 108, 69) var line : array 1 .. 4 of int := init (71, 58, 58, 71) var linea : array 1 .. 4 of int := init (145, 142, 110, 107) drawfillpolygon (line, linea, 4, 54) end movcar movcar var face : array 1 .. sizepic (0, 99, 80, 151) of int process a takepic (0, 99, 80, 151, face) for x : 0 .. 308 drawpic (x, 99, face, 0) delay (10) exit when x = 308 end for end a %------CAR2----------------- process movcar2 drawfillbox (404, 2, 458, 63, 64) drawfillbox (408, 58, 423, 63, 68) drawfillbox (435, 58, 450, 63, 68) drawfillbox (412, 5, 450, 36, 148) var age : array 1 .. 4 of int := init (409, 412, 450, 453) var fag : array 1 .. 4 of int := init (53, 40, 40, 53) drawfillpolygon (age, fag, 4, 54) end movcar2 fork movcar2 fork a var car : array 1 .. sizepic (404, 0, 458, 63) of int takepic (404, 0, 458, 63, car) for x : 0 .. 400 drawpic (404, x, car, 0) delay (30) exit when x = 98 View.Update end for Sorry... it's the same question again. But I seriously don't understand what is causing the black thing and what is causing the white wipe-outs. I want to just leave the process so I tried and tried. But I just can't figure it out! UGHHHHHH!!!!!!! Please let me know what's wrong. P.s.Thank you guys very much for answering my previous question. |
Author: | Tony [ Sun Jan 08, 2006 3:13 am ] |
Post subject: | |
this is because you draw images inside the process, and display them to screen outside of the process. Since the two are not concurent, there will be times where you will update your screen only after a part of the image has been drawn. |
Author: | cool dude [ Sun Jan 08, 2006 10:31 am ] |
Post subject: | |
why do u even need processes. i suggest staying away from them because they cause a lot of problems. if u want use procedures and your problem will go away. |