Moving object from point to point...

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

Very very thanks!!!
Yes that make sense at all :P
I don't know very well this sort of math things (even if they interest me a lot...i think i can buy some math books)
Your piece of information has give me a great boost.
I have corrected the code above (i have reach discovered the error!it was't in the look-up table but in the function determining the angle!).
I have another question:i have read to use sin-cos table to give some speed boost to my code,the function that you tell me "SQRT" is cpu intensive?
Because i use these function to move a lot of object onscreen at the same time.
Here's the correct code:

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
If r1=>359 Then r1=0
End Function
;------------------------------------
;Forward & Backward Motion
Function strightMov()
x2=144+Sin2#(r2)*32
y2=192
DrawImage enemys,x2,y2+2
r2=r2+2.5
If r2=>359 Then r2=0
End Function
;------------------------------------
;Up & Down Motion
Function updownMov()
x3=144
y3=124+Cos2#(r3)*32
DrawImage enemys,x3,y3+2
r3=r3+2.5
If r3=>359 Then r3=0
End Function