Computer Science Canada windshield wipers |
Author: | fab42 [ Wed Feb 25, 2004 7:22 pm ] |
Post subject: | windshield wipers |
this is what i got so far how do i get the lines to move together in a curve and when i wipe the dots how do i keep making it rain while its still wiping. i'm not sure how to move the lines together this is what i tryed var x, y, c : int for i : 1 .. 1500 randint (x, 0, maxx) randint (y, 0, maxy) randint (c, 0, maxcolor) drawdot (x, y, c) end for var t := 45 var reply : string (1) var arm := 250 var d := 379 var e := 378 var w := 100 var p := 260 var px, py : real px := 200 + arm * cosd (t) py := arm * sind (t) locate (12, 10) put "Press any key to start ..." .. locate (12, 55) put "then press a key to stop" .. drawline (200, 0, round (px), round (py), black) drawfillbox (379, 100, 378, 260, black) getch (reply) loop for i : 1 .. 90 drawfillbox (d, w, e, p, black) delay (50) drawfillbox (d, w, e, p, white) d -= 2 e -= 2 drawline (200, 0, round (px), round (py), black) delay (50) drawline (200, 0, round (px), round (py), white) t += 1 px := 200 + arm * cosd (t) py := arm * sind (t) end for for i : 1 .. 90 drawline (200, 0, round (px), round (py), black) delay (50) drawline (200, 0, round (px), round (py), white) t -= 1 px := 200 + arm * cosd (t) py := arm * sind (t) end for end loop |
Author: | jonos [ Wed Feb 25, 2004 8:11 pm ] |
Post subject: | |
this must be a project or something because i have seen this before. search around this forum (or use the search) and you will find it, it has the source. anyways to have them move at the same time, you make both of the mo0vements in the same loop. im not quite sure what you mean by all what you said. |
Author: | Cervantes [ Thu Feb 26, 2004 5:23 pm ] | ||
Post subject: | |||
There are two ways in which you can do good graphics. Both use View.Update 1.) clear the screen then redraw everything 2.) draw the object, view.update, delay, then draw the same object only in the background colour For this problem I suggest going with the first option. Here's a simple bit of code of how I would make winsheild wipers.
|