Strobing screen.

Blitz3D Forums/Blitz3D Beginners Area/Strobing screen.

I tried redoing it, the thing is the way I did it, I just got a blank screen.
timer=MilliSecs()
hertz=8
Graphics 800,600,0,0
SetBuffer BackBuffer()
waittime=1000/hertz
checktime=waittime
While Not KeyDown(1)
	timepassed=MilliSecs() - timer
	If timepassed=checktime
		ClsColor(255,255,255)
		Cls
		checktime=checktime+waittime
	ElseIf timepassed<>checktime
		ClsColor(0,0,0)
		Cls
	EndIf
	Flip
Wend


I realised it's probably because of the If timepassed=checktime part, where the timepassed just misses the checktime. I altered it again to..

timer=MilliSecs()
hertz=8
Graphics 800,600,0,0
SetBuffer BackBuffer()
waittime=1000/hertz
checktime=waittime
While Not KeyDown(1)
	timepassed=MilliSecs() - timer
	If timepassed>=checktime
		ClsColor(255,255,255)
		Cls
		checktime=checktime+waittime
	ElseIf timepassed<checktime
		ClsColor(0,0,0)
		Cls
	EndIf
	Flip
Wend


This seems to work, but I don't know how accurate it is now. and the lower the value of 'hertz' the more inaccurate it'll be, because it's not flashing on the checktime exactly. After trying something like 40 for the hertz value it's not too accurate there either.. =(