Really simple thing....

Blitz3D Forums/Blitz3D Beginners Area/Really simple thing....

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.

This lets it go at any angle, instead of just 0,45,90 etc:
Graphics 800,600,32,2

SetBuffer BackBuffer()

Global Rx# = 10
Global Ry# = 10
Global goX#, goY#
;alter this to change movement speed
Global speed#=2
Repeat
Cls
Mx% = MouseX()
My% = MouseY()
Rect Rx-50, Ry-50, 100, 100, 0
If MouseHit(2) Then
	goX = Mx
	goY = My
EndIf
dx#=(goX-rx)
dy#=(goY-ry)
l#=Sqr(dx*dx+dy*dy)
If l>1

	dx=dx/l
	dy=dy/l
	rx=rx+dx * speed#
	ry=ry+dy * speed#
	
Else

	Text 400,300,"Target reached!",1,1

EndIf
Oval goX-3,goY-3,6,6,0
Flip
Until KeyHit(1)
End