Computer Science Canada

Need Help with my Stoplight program I got one light...

Author:  CrazyTiger [ Mon Jan 09, 2006 7:41 pm ]
Post subject:  Need Help with my Stoplight program I got one light...

code:
setscreen ("graphics:vga")

%Next four lines sets up the diagram of a traffic light

drawbox (270,140,330,310,14) % Outlines the stoplight in yellow (14)

drawoval (300, 275, 20, 20 , 4) % Red light outline(4)

drawoval (300, 225, 20, 20 , 14) % Yellow light outline (14)

drawoval (300, 175, 20, 20 , 10) % Green light outline (10)

%Normal light sequence

loop

    exit when hasch
   
    drawfilloval (300, 175, 20, 20 , 10)    % Green light fill (10)
    delay (4000)                            % Wait 4 seconds
    drawfilloval (300, 175, 20, 20 , 0)     % Black light fill (0)
    drawoval (300, 175, 20, 20 , 10)        % Green light outline (10)

    drawfilloval (300, 225, 20, 20 , 14)    % Yellow light outline (14)
    delay (4000)                            % Wait 4 seconds
    drawfilloval (300, 225, 20, 20 , 0)     % Black light fill (0)
    drawoval (300, 225, 20, 20 , 14)        % Yellow light outline (14)
   
    drawfilloval (300, 275, 20, 20 , 4)     % Red light fill (10)
    delay (4000)                            % Wait 4 seconds
    drawfilloval (300, 275, 20, 20 , 0)     % Black light fill (0)
    drawoval (300, 275, 20, 20 , 4)        % Red light outline(10)
end loop

%I got this far but i need to make a 4 way stop wht should i do???

Author:  pavol [ Mon Jan 09, 2006 7:56 pm ]
Post subject: 

duplicate your code for the stop light and change the x and y values so you see four of the lights. and then make them change however you want, one by one or a couple at a time.


: