Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Dad1916 on November 04, 2012
-
Imagine I'm using a basic language to code a demo. It's fine, it's structural but how do I go about the timing? Imagine I want a scene to last 10 seconds and then 20 seconds on the next? Functions for each and delays? :hi:
-
what the name of programming langauge you using? :)
-
On every OS, you can get the system time. Just have to wait until the good time and so on...
example (in pseudo language):
start = get_time_function() 'in millisecond usualy
repeat
'do the effect
until get_time_function() > (start + 20*1000)
If you want to specific code in a language, we can make it also :D
-
Yeah, you'd need to get the time as a float or double ( gives more precision based timing ), and then multiply by 1000.00f this will give the time in millisecs. It is a misleading term as you'd expect it to have six zeros after it. And in the example above, 20 seconds is 20 * 1000.00.
And you could even use switch / case statements to signify which part of the demo to run.
-
I know this topic is old, but my question is also about timing: how about using the audio timing to implement graphics and effects?
Instead of getting the system time, you get the current audio time. Is that usually done / not done? What would be the downsides (if any) or advantages (again, if any)?
-
Both method can do the work. Theres no downsides or advantages in this case, the best way is to try both and see which one you will be more comfortable to work it.