set display mode 800,600,32
sync on : sync rate 60
 
gosub menu
 
cls rgb(255,255,255)
ink rgb(175,175,175),0
 
box 0,0,799,400
ink 0,0
line 100,400,100,0:line 300,400,300,0:line 500,400,500,0:line 700,400,700,0
ink rgb(75,75,75),0
line 80,599,100,400:line 280,599,300,400:line 480,599,500,400:line 680,599,700,400
get image 2,0,0,799,599
cls rgb(255,255,255)
ink rgb(175,175,175),0
box 0,175,130,200
ink 0,0
 
circle 100,200,25 : line 100,225,100,325 : line 75,400,100,325 : line 125,400,100,325 : line 75,300,100,225
ink rgb(255,255,255),0:for cc=0 to 24:circle 100,200,cc:box 86,180,114,215:box 80,186,120,214:next cc:ink 0,0
get image 1,0,175,130,470
 
Game:
 
ppx=0:ppy=375:scx=0:scxx=799:pax=100:scxxx=799+799:aax=125:mouseclicked=9:xvel#=0:mx=0:my=0:xvel=0:yvel=0:cx=0:cy=0:ay=0:ax=0
Position mouse pax+30,pay+50:set text size 10
 
do
 
ax=mousex()
ay=mousey()
cx=mousex()
cy=mousey()
 
if mouseclicked=2
	paste image 2,scx,0:paste image 2,scxx,0:paste image 1,ppx,ppy
	scx = scx - xvel:scxx = scxx - xvel:ppx = ppx - xvel:pax = pax - xvel:aax = aax - xvel
	line aax,300,pax,425
	yvel = yvel + 5
	my = my + yvel
	if my >= screen height()-10
	   my = screen height()-10
	   yvel = 0 - yvel
	   xvel = xvel * 0.80
	   yvel = yvel * 0.80
	endif
	circle mx,my,10
	if xvel=0 and yvel<=1 and yvel>=-1 then gosub ends
else
	if mouseclicked=9
	else
		paste image 2,0,0:paste image 2,799,0:paste image 1,0,375
		line ax,ay,pax,425
		circle cx,cy,10
		if mouseclick() = 1
		   mx = mousex()
		   my = mousey()
		   xvel = mousemovex() * 2
		   yvel = mousemovey() * 2
			mouseclicked=1
		endif
	endif
endif
if mouseclick()=0 and mouseclicked=1 then mouseclicked=2
 
center text 400,10,"Click, Drag, and let go of the mouse to throw the ball."
xvel#=xvel#+xvel
center text 400,30,"Distance: "+str$(xvel#)
center text 400,50,"Highscore: "+str$(hs)
 
if scx<=-799 then scx=scxx+799
if scxx<=-799 then scxx=scx+799
if scx>=799 then scx=scxx-799
if scxx>=799 then scxx=scx-799
 
if mouseclicked=9 and mouseclick()=0 then mouseclicked=0
 
sync
 
cls rgb(255,255,255)
loop
 
ends:
if xvel#>hs then hs=xvel#
center text 400,10,"Click, Drag, and let go of the mouse to throw the ball."
center text 400,30,"Distance: "+str$(xvel#)
center text 400,50,"Highscore: "+str$(hs)
center text 400,300,"Press the spacekey to continue."
suspend for key
gosub game
 
Menu:
sxvel=0
syvel=0
msx=400
msy=screen height()-10
do
set text size 50
ink rgb(rnd(255),rnd(255),rnd(255)),0
center text 300,25,"F"
ink rgb(rnd(255),rnd(255),rnd(255)),0
center text 350,25,"L"
ink rgb(rnd(255),rnd(255),rnd(255)),0
center text 400,25,"I"
ink rgb(rnd(255),rnd(255),rnd(255)),0
center text 450,25,"N"
ink rgb(rnd(255),rnd(255),rnd(255)),0
center text 500,25,"G"
set text size 30
if mousex()>350 and mousex()<450 and mousey()>150 and mousey()<200
	ink rgb(255,255,0),0
	center text 400,150,"Easy"
	if mouseclick()=1
		friction=0.80
		return
	endif
else
	ink rgb(0,0,255),0
	center text 400,150,"Easy"
endif
if mousex()>320 and mousex()<480 and mousey()>300 and mousey()<350
	ink rgb(255,0,255),0
	center text 400,300,"Medium"
	if mouseclick()=1
		friction=0.50
		return
	endif
else
	ink rgb(0,255,0),0
	center text 400,300,"Medium"
endif
if mousex()>340 and mousex()<460 and mousey()>430 and mousey()<500
	ink rgb(0,255,255),0
	center text 400,450,"Hard"
	if mouseclick()=1
		friction=0.30
		return
	endif
else
	ink rgb(255,0,0),0
	center text 400,450,"Hard"
endif
ink 0,0
syvel=syvel+3
msx = msx + sxvel
msy = msy + syvel
if msy >= screen height()-10
   msy = screen height()-10
   syvel = 0 - syvel
   sxvel = sxvel * 0.90
   syvel = syvel * 0.90
endif
if msy <= 10
   msy = 10
   syvel = 0 - syvel
endif
if msx >= screen width()-10
   msx = screen width()-10
   sxvel = 0 - sxvel
endif
if msx <= 10
   msx = 10
   sxvel = 0 - sxvel
endif
if mouseclick()=1
	msx=mousex()
	msy=mousey()
	sxvel=mousemovex()*2
	syvel=mousemovey()*2
endif
circle msx,msy,10
sync
cls rgb(255,255,255)
loop