Strobing screen.

Blitz3D Forums/Blitz3D Beginners Area/Strobing screen.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Millisecs() go too fast for each loop to be one millisecs. Usually 8 or 9 millisecs pass with each loop. Try this function that I picked up somewhere. Run the function each loop, and it will calculate an average of the last 20 loops, making it more acurate than simple millisecs(). gLoopTime is on average how much time it has taken per loop, so you can add this to another variable to determine how much time has past or will past.

;clock
Dim savedClockTime#(20)
Global savedClockCount
Global gLoopTime#

Function UpdateGameClock()
	savedClockCount = savedClockCount+1
	If savedClockCount = 20 Then savedClockCount = 0
	Local time# = MilliSecs()
	gLoopTime# = (time#-savedClockTime#(savedClockCount))/20000	
	savedClockTime#(savedClockCount) = time#
	If gLoopTime# > .1 Then gLoopTime# = .0167	
End Function