
-----------------------------------
sllipnot2
Thu Jun 07, 2007 7:13 pm

traffic lights flash help
-----------------------------------
hey everybody 
i need help, if someone is willing to help me plzzzzzzzzzzzzzzzzzzzzzzzzz for my traffic lights to flash as for normal , i shall show u the my code for the traffic 
drawfillbox (321, 185, 392, 204, brown) 
drawfillbox (390, 192, 398, 200, brown) 
drawfilloval (329, 196, 7, 7, red) 
drawfilloval (352,197, 7, 7, yellow) 
drawfilloval (375,197, 7, 7, green) 
plzzzzzzzzzzzzz help i am new at this program !

-----------------------------------
Saad
Thu Jun 07, 2007 7:19 pm

Re: traffic lights flash help
-----------------------------------
Basically what you need is a delay, the usage of delay is delay([time in miliseconds]), so after every light gets drawn i would add a delay(1000)

-----------------------------------
LaZ3R
Thu Jun 07, 2007 7:22 pm

Re: traffic lights flash help
-----------------------------------
loop
    drawfillbox (321, 185, 392, 204, brown)
    drawfillbox (390, 192, 398, 200, brown)
    drawfilloval (329, 196, 7, 7, red)
    drawfilloval (352, 197, 7, 7, 68)
    drawfilloval (375, 197, 7, 7, green)
    drawfilloval (375, 197, 7, 7, brightgreen)
    delay (1000)
    drawfilloval (375, 197, 7, 7, green)
    drawfilloval (352, 197, 7, 7, yellow)
    delay (1000)
    drawfilloval (352, 197, 7, 7, 68)
    drawfilloval (375, 197, 7, 7, green)
    drawfilloval (329, 196, 7, 7, brightred)
    delay (1000)
end loop

It's terrible code but I'm studying for physics (even though I'm on compsci... :S) and I don't feel like thinking too hard :)

You need to simply use delays for such a simple idea like this and a loop if you want to constantly run through the lights.
