Moving object from point to point...

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

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

;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