Help me optimize this code

BlitzPlus Forums/BlitzPlus Programming/Help me optimize this code

You can avoid Sin, Cos and Atan2 completely:
Const width = 640, height = 480
Const KEY_ESC = 1

Graphics width, height
SetBuffer BackBuffer( )
HidePointer
MoveMouse .75 * width, height / 2

playerx# = 320
playery# = 240
speed# = 2.0

While Not KeyDown( KEY_ESC )

ballx# = MouseX()
bally# = MouseY()

Cls
Color 0, 0, 255		Oval playerx - 3, playery - 3, 7, 7, True		; Draw Player
Color 255, 255, 255	Oval ballx  - 3, bally - 3, 7, 7, True			; Draw Ball
Color 255,255,0		Line playerx, playery, ballx, bally			; I Draw The Line Here

a# = ballx-playerx
b# = bally-playery
distance# = Sqr(a*a + b*b)

Color 255, 255, 255		Text 10,10, "Ball x = " + ballx
Color 255, 255, 255		Text 10,20, "Ball y = " + bally
Color 255,255,0			Text 10,40, "Distance = " + distance

xplus# = a * (speed / distance)
yplus# = b * (speed / distance)

Text 10,50, "Move x = "+xplus
Text 10,60, "Move y = "+yplus

playerx = playerx + xplus
playery = playery + yplus

Flip
Wend

End