Moving object from point to point...

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

;taget A to B

x1#=300.0;A position X
y1#=300.0;A position Y

x2#=0.0;B position X
y2#=0.0;B position Y

x#=0.0;bullet position X
y#=0.0;bullet position Y
speed#=1.0;bullet speed

angle#=0.0;angle


;game loop

angle=ATan2((y2 - y1),((x2 - x1));do it just one time

x=(x+Cos( angle ))*speed)
y=(y+Sin( angle ))*speed)

drawblock yourimage,x,y