can someone give me a bit of coe that will make a car turn please
thanks
thanks
Graphics 800, 600, 0, 2 SetBuffer BackBuffer() ;if this is 1, the program will generate 360 image; one for each angle Const anglesteps = 5 ;make original car orgcar = CreateImage(128, 128) Rect 40, 32, 48, 64, 0 Rect 42, 34, 44, 22 GrabImage orgcar, 0, 0 MidHandle orgcar ;make 72 rotated images (360 / 5) Dim car(360) For i = 0 To (360 / anglesteps) - 1 tempcar = CopyImage(orgcar) RotateImage tempcar, (i * anglesteps) + 90 Cls DrawImage tempcar, 48, 48 car(i) = CreateImage(80, 80) GrabImage car(i), 8, 8 Rect 8, 8, 80, 80, 0 MidHandle car(i) FreeImage tempcar Flip Next ;best is, to save these images onto disk so you only need to generate them once. Cls carangle = 0 x# = 400 y# = 300 speed# = 5 ;main loop Repeat ;draw car image Cls carframe = carangle / anglesteps DrawImage car(carframe), x, y Flip ;up/down If KeyDown(200) Then x = x + Cos(carangle) * speed y = y + Sin(carangle) * speed End If If KeyDown(208) Then x = x - Cos(carangle) * speed y = y - Sin(carangle) * speed End If ;left/right If KeyDown(203) Then carangle = carangle - 2 If KeyDown(205) Then carangle = carangle + 2 If carangle < 0 Then carangle = 359 If carangle > 359 Then carangle = 0 ;esc=exit Until KeyHit(1) End
If carangle < 0 Then carangle = 358 If carangle > 358 Then carangle = 0
If KeyDown(203) Then carangle = (carangle + (360-speed)) Mod 360 If KeyDown(205) Then carangle = (carangle + speed) Mod 360