Re: time loop
- Posted by Michael Packard <lgp at EXO.COM> Nov 22, 1997
- 600 views
On Sat, 22 Nov 1997, The Reaper wrote: > Hi, does anyone know what I can put in my game's major loop, so that if a > certain time hasn't passed, the game will wait? > > (Thus controlling the speed of the game through different situations and > different computers) > > yeah at the beginning for your main loop (somewhere) add something like frameclock=time() Then at the bottom do something like while time()-frameclock< whatevertimeyouwannawait do end while when it gets to the while, if the amount of time you want hasn't already passed it'll wait until it has then go on. This just waits, it does no processing. If you want to process anything while you wait (like looking at keys and doing something about them) stick the code between the while and end while. Michael