Day timer

Blitz3D Forums/Blitz3D Beginners Area/Day timer

kantuno(Posted 2015) [#1]
I am making an RTS game, and I have encountered a problem with the timer. I want it to work so that, every 30 seconds, the variable day# goes up one. So the game starts at day 1, 30 seconds later it is day 2, etc.

How do I go about doing this? The timer needs to loop forever, until the game is closed.

Thanks in advance!


videz(Posted 2015) [#2]
this is a quick and dirty example, I made it using BlitzPlus. Try and use similar functions with Blitz3D..

Graphics 800,600,0,2
SetBuffer BackBuffer()

Day% = 1;

current=MilliSecs()
	
; wait for ESC key before ending
While Not KeyHit(1)

	;Main Game Loop
	Cls
	Text 100,0,"Day " + Day,True,False	
	If MilliSecs() > current + 30000 Then ;30 seconds/day
	  Day = Day + 1
	  current = MilliSecs()
	End If

	Flip
	
Wend 


let me know if that helps.


kantuno(Posted 2015) [#3]
Worked like a charm! Thanks a million!