'This program allows you to control
'sonic using the mouse. Point the
'mouse where you would like sonic
'to walk and press the left mouse
'button. The sprite will walk
'towards that point. If you press
'the right mouse button, sonic
'will jump. If you press both the
'left and right mouse buttons
'simultaneously, this program
'will terminate.
start
mouseon% 1
var1! = adx% - 160
dx% = var1! / 2 + dx%
steps! 0
do
if lb% = -1 then gosub addit
if var1! <> 0 and var2! = 999 then speed! 10
if dx% < var3! and col% = 2 then gosub endit
if dx% > var3! and col% = 1 then gosub endit
if rb% = -1 then jumpp% 1
doevents
loop until rb% = -1 and lb% = -1
gosub theend

addit:
var1! = adx% - 160
var1! = var1! / 2
if var1! < 0 then col% 2
if var1! >= 0 then col% 1
var2! = 999
var3! = var1! + dx%
return

endit:
if var2! <> 999 then return
speed! = 0
var1! = 0
var2! = 0
var3! = 0
return

theend:
end
run

