Computer Science Canada Traffic light program, animation speeding up for no reason! |
Author: | Xiphos [ Sat May 14, 2016 9:45 am ] | ||
Post subject: | Traffic light program, animation speeding up for no reason! | ||
What is it you are trying to achieve? I'm trying to make a traffic light program with 2 sets of lights that are tied to eachother, and two cars that stop at the intersection if the light for that lane is red. What is the problem you are having? It works fine for a few loops (car reaches the end and redraws at the beginning) but after a few loops the cars start to freak out; running red lights, speeding up, drawing weird shapes etc. Describe what you have tried to solve this problem I tried extending the range in which the cars will stop when they see a red light, and i tried resetting the speed variable at the end of the loop Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Here is a pastebin link to the full code: http://pastebin.com/fzdP0dTm The code for just the car:
Please specify what version of Turing you are using 4.1.1 Help is greatly appreciated! |
Author: | Dreadnought [ Sun May 15, 2016 5:41 pm ] |
Post subject: | Re: Traffic light program, animation speeding up for no reason! |
You're using processes. That in and of itself is cause for concern. It would be best if you rewrote your program to avoid using processes (seriously). I don't really know what is causing your problem, but you might want to check how many Hcar and Vcar processes you have running at any given time. |