Moving object from point to point...

BlitzPlus Forums/BlitzPlus Programming/Moving object from point to point...

I have searched forr look-up tables and found this piece of code....
But if you cut&paste and execute....when those object have made a movement...i have "array out of bounds" error.....
Here's the code:(don't remember how to paste correctly in the forum...)


;SIN/COS Lookup Table
Dim Sin2#(360)
Dim Cos2#(360)
For loop=0 To 359
Sin2#(loop)=Sin(loop)
Cos2#(loop)=Cos(loop)
Next










Const scrX=320,scrY=240
;------------------------------------
Global r1#,r2#,r3#
;------------------------------------
;setup
Graphics scrX,scrY,32,2
SetBuffer BackBuffer()
;------------------------------------
;loadgrafx
Global backGnd=LoadImage("go.bmp")
Global enemys=LoadImage("enemy.bmp")
;------------------------------------
;loop
While Not KeyDown(1)
Cls
TileImage backGnd,ixTim,iyTim
circleMov()
strightMov()
updownMov()

Flip
Wend
End
;Circle Motion
Function circleMov()
x1=160+Sin2#(r1)*32
y1=64+Cos2#(r1)*32
DrawImage enemys,x1,y1
r1=r1+2.5
End Function
;------------------------------------
;Forward & Backward Motion
Function strightMov()
x2=144+Sin2#(r2)*32
y2=192
DrawImage enemys,x2,y2+2
r2=r2+2.5
End Function
;------------------------------------
;Up & Down Motion
Function updownMov()
x3=144
y3=124+Cos2#(r3)*32
DrawImage enemys,x3,y3+2
r3=r3+2.5
End Function


I think i have this error because when i reach 360 degrees the lookup table must be reset to o.....don't know how!
Thanks.