Timers

Blitz3D Forums/Blitz3D Programming/Timers

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.

Make your own timers, that's what i say ;o)

This should do the trick:

Graphics3D 800,600
SetBuffer BackBuffer()



Global camera = CreateCamera()
PositionEntity camera,0,0,-20

Global light = CreateLight()

Global cube = CreateCube()
PositionEntity cube,-10,0,0

Global timer = MilliSecs()
Global time = 5000

Global move_x = 1
Global move_y = 0
Global move_z = 0


While Not KeyHit(1)

	; IF the value of millisecs() is GREATER than the PREVIOUS value of millisecs() held in TIMER
	; PLUS the value of time, then your 5 seconds has pass
	If MilliSecs() > time + timer Then
		timer = MilliSecs() ; reset the timer to the current value of millisecs()
		MoveEntity cube,move_x,move_y,move_z ; moves the cube, according to the variable
	End If


	UpdateWorld
	RenderWorld
	Flip
Wend
End