help with cars

Blitz3D Forums/Blitz3D Beginners Area/help with cars

Here is a working example on how to record your mouse pointer. It should get you started.

;
; Recording example
;

Graphics 640,480,16,2
SetBuffer BackBuffer()

Dim cai(999,3)
Global tm = MilliSecs()
Global recordlen = 0 ; This variable will store the total length of the recording
Global playback = False
Const recordrate = 20

While KeyDown(1) = False
	Cls
	Text 0,0,"Move the mouse around and then press the left mouse to play back"
	Text 0,20,"Position " + counter
	
	If playback=False And counter < 1000 Then
		If tm+recordrate < MilliSecs() Then
			cai(counter,0) = MouseX()
			cai(counter,1) = MouseY()
			counter = counter + 1			
			tm = MilliSecs()
		End If
	End If
	;
	If MouseHit(1) = True Then playback = True : recordlen = counter : counter = 0
	;
	If playback = True Then
		If tm+recordrate < MilliSecs() Then
			Rect cai(counter,0),cai(counter,1),10,10,1
			counter = counter + 1
			If counter > recordlen Then counter = 0
		End If
	End If
	Flip
Wend