Computer Science Canada Time.Elapsed Help |
Author: | Gunz [ Sun Jan 02, 2011 9:46 am ] | ||
Post subject: | Time.Elapsed Help | ||
Sorry, I am sort of new to turing and my Time.Elapsed starts counting down as soon as my program runs, not when the user clicks on Level 1. What is it you are trying to achieve? I want my Time.Elapsed to starting counting down only when I want it to count down. What is the problem you are having? So as soon as my program runs, it counts down from 120 and when I choose level 1 it only has like 100 seconds left because the intro takes about 20 secs to run. Is there any way I can do this??? Below is my timer..
Please specify what version of Turing you are using <Answer Here> |
Author: | Dragon20942 [ Sun Jan 02, 2011 12:10 pm ] |
Post subject: | RE:Time.Elapsed Help |
Then use an if statement saying if you select level 1, timeDisplay. Looks like a sequence error to me. Can u post the whole code? |
Author: | TerranceN [ Sun Jan 02, 2011 12:28 pm ] | ||
Post subject: | RE:Time.Elapsed Help | ||
No I think it's because Time.Elapsed() finds the time since the program started. You need to compare it to the time the game starts running, so something like this
Note the line where timeLeft is set, I found the difference in time between how long the program has been running and the startTime, then used that value just like you did. |
Author: | Gunz [ Sun Jan 02, 2011 3:09 pm ] |
Post subject: | Re: Time.Elapsed Help |
Exactly what the problem was Terrance, thanks!! |