help with cars

Blitz3D Forums/Blitz3D Beginners Area/help with cars

Store the x,y locations in a array every so many milliseconds while you record. Also store the rotation for the car every time.

Be sure to increase the counter of the array every time you record the position. The counter being used to see where to put the recording.

Here is some crude example code

; this array will store 9999 positions. Or 499 seconds
; if you record every 20 milliseconds.
dim cai(9999,3)

;This we use to time the recording
global tm = millisecs()

>Code for in your game loop

;Record every 20 milliseconds
if tm + 20 < millisecs() then
cai(counter,0) = carx
cai(counter,1) = cary
cai(counter,2) = carrot
counter = counter + 1
tm = millisecs()
end if

>back to your start of the loop

You could also use types for storing the position. This is just a simple example.

And stop eating so much sugar :)

ps - Be sure to store the array. Write it to a file. Look up the file functions.