set display mode 640,480,32
sync on : sync rate 100
hide mouse
  maxT=50
  dim time(maxT)
  dim x(maxT)
  dim y(maxT)
  dim Etime(maxT)
  dim dir(maxT)
 gosub cross:cls
 gosub circle
Restart:
 gosub menu:cls
restore round1 
maxT=25
score=0
round=0
shots#=0
`               ~MAIN LOOP~
DO
if shots#>0
text 270,180, "4X TARGETS "+str$(hit#)+"/"+str$(maxT)
text 270,200, "1X HIT%:"+str$((hit#/shots#)*100.0)
text 270,220, "2X BULLSEYE%:"+str$((bull#/shots#)*100.0)
bonus=((hit#/shots#)*100.0)+(2*((bull#/shots#)*100.0))+(4*hit#)
text 270,240, "BONUS:"+str$(bonus)
score=score+bonus
text 270,260, "SCORE:"+str$(score)
sleep 500
suspend for mouse:cls
endif
round=round+1
if round=6 then goto win
if round=5 then maxT=50
bull#=0:hit#=0:miss#=0:shots#=0
a=0
ink rgb(40,40,40),0
box 0,450,639,479
ink rgb(255,255,255),rgb(20,20,20)
  text 50,457, "SCORE:"+str$(score)
if shots#>0
  text 225,457, "HIT%:"+str$((hit#/shots#)*100.0)
  text 435,457, "BULLSEYE%:"+str$((bull#/shots#)*100.0)
endif 
text 270,220, "ROUND "+str$(round)
sleep 3000:cls
oldtime=timer()
for n=1 to maxT
 read time(n)
 read Etime(n)
 read x(n)
 read y(n)
 read dir(n)
x(n)=x(n)*64-64
y(n)=y(n)*64-64
next n
WHILE forever=0
oldmiss=miss#:oldhit=hit#:oldbull=bull#
ink rgb(40,40,40),0
box 0,450,639,479
ink rgb(255,255,255),rgb(20,20,20)
  text 50,457, "SCORE:"+str$(score)
if shots#>0
  text 225,457, "HIT%:"+str$((hit#/shots#)*100.0)
  text 435,457, "BULLSEYE%:"+str$((bull#/shots#)*100.0)
endif  
if a>0
 if color=1 then ink rgb(0,0,225),rgb(20,20,20)
 if color=2 then ink rgb(0,175,0),rgb(20,20,20)
 if color=3 then ink rgb(225,225,0),rgb(20,20,20)
 if color=4 then ink rgb(225,0,0),rgb(20,20,20)
 text oldmx-21,oldmy-10, text$
 ink rgb(255,255,255),rgb(20,20,20)
 a=a-1
endif
  mx=mousex():my=mousey()
  time=(timer()-oldtime)/1000
 
for n=1 to maxT
 if time>=time(n) and time<=Etime(n)
if dir(n)>0
 if dir(n)=1 then y(n)=y(n)-1
 if dir(n)=2 then x(n)=x(n)+1
 if dir(n)=3 then y(n)=y(n)+1
 if dir(n)=4 then x(n)=x(n)-1
endif
paste image n,x(n),y(n),1 
 endif
next n
  if mouseclick()=0 then press=0
  if mouseclick()=1 and press=0 
   press=1
for n=1 to maxT
if time>=time(n) and time<=Etime(n)
num=circlemouseover(x(n)+25,y(n)+25,24)
   if num=1 then score=score+10:gosub check:hit#=hit#+1:color=1
   if num=2 then score=score+20:gosub check:hit#=hit#+1:color=2
   if num=3 then score=score+30:gosub check:hit#=hit#+1:color=3
   if num=4 then score=score+50:gosub check:hit#=hit#+1:color=4:bull#=bull#+1
  endif
next n
if hit#=oldhit
   color=0
   miss#=miss#+1
endif 
endif
   shots#=miss#+hit#
if oldmiss<miss# then a=27:text$="Miss":oldmx=mx:oldmy=my
if oldhit<hit# then a=27:text$="Hit":oldmx=mx:oldmy=my
if oldbull<bull# then a=27:text$="Bullseye":oldmx=mx:oldmy=my
 paste image 51,mx-8,my-8,1
if round=1 and time=34 then cls:exit
if round=2 and time=22 then cls:exit
if round=3 and time=24 then cls:exit
if round=4 and time=25 then cls:exit
if round=5 and time=33 then cls:exit
sync:cls
ENDWHILE
 
LOOP
 
END
 
`               ~SUB FILES~
 
win:
cls
oldfont$=text font$()
oldsize=text size()
set text size 100
set text font "verdana"
text 50,190, "SCORE:"+str$(score)
sleep 500
repeat
text 50,190, "SCORE:"+str$(score)
sync
cls
until mouseclick()=1
set text size oldsize
set text font oldfont$
sync
goto restart
 
cross:
ink rgb(200,200,200),0
line 8,0,8,16
line 0,8,16,8
ink rgb(0,0,0),0
dot 8,8
get image maxT+1,0,0,16,16
return
 
menu:
ny=223
nx=-100
do
cls
paste image 1,nx,ny,1
ink rgb(255,255,225),rgb(20,20,20)
text 190,190, "Get points by shooting the targets"
ink rgb(0,0,225),rgb(20,20,20)
text 190,210, "BLUE:10"
ink rgb(0,175,0),rgb(20,20,20)
text 190,230, "GREEN:20"
ink rgb(225,225,0),rgb(20,20,20)
text 190,250, "YELLOW:30"
ink rgb(225,0,0),rgb(20,20,20)
text 190,270, "RED:50"
if nx<125 then nx=nx+1
ink rgb(255,255,225),rgb(20,20,20)
if nx=125 then text 190,290, "Click to continue"
if nx=125 and mouseclick()=1 then exit
sync
loop
return
 
check:
 x(n)=1000:y(n)=1000
return
 
`        ~That1Smart Guy's circlemaker~
circle:
ink rgb(0,0,225),0
 
   for x=0 to 49
      for y=0 to 49
         if distance#(x,y,25,25)<=24
            dot x,y
         endif
      next y
   next x
```````
ink rgb(0,175,0),0
 
   for x=0 to 49
      for y=0 to 49
         if distance#(x,y,25,25)<=18
            dot x,y
         endif
      next y
   next x
```````````
ink rgb(225,225,0),0
 
   for x=0 to 49
      for y=0 to 49
         if distance#(x,y,25,25)<=12
            dot x,y
         endif
      next y
   next x
`````````
ink rgb(225,0,0),0
 
   for x=0 to 49
      for y=0 to 49
         if distance#(x,y,25,25)<=6
            dot x,y
         endif
      next y
   next x
for x=1 to maxT
   get image x,0,0,60,60
next x
return
`````````````````````~That1Smart Guy's insidecirclefinder~
function circlemouseover(x,y,rad)
mx=mousex() : my=mousey()
dist#=distance#(mx,my,x,y)
if dist#<=rad-18 then exitfunction 4
if dist#<=rad-12 then exitfunction 3
if dist#<=rad-6 then exitfunction 2
if dist#<=rad then exitfunction 1
endfunction 0
 
function distance#(x1,y1,x2,y2)
dist#=abs(sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))))
endfunction dist#
`````````````````````
`            ~DATA~
`   time-start,time-end,X,Y,direction
Round1:
data 1,5,4,4,0, 2,5,5,4,0, 3,5,6,4,0, 4,5,7,4,0, 6,11,7,3,0
data 6,11,4,3,0, 6,11,4,5,0, 6,11,7,5,0, 12,15,5,3,0, 12,15,7,3,0
data 13,15,5,5,0, 13,15,7,5,0, 16,23,1,4,0, 17,23,10,4,0, 18,23,5,1,0
data 19,23,6,7,0, 20,23,6,1,0, 21,23,5,7,0, 22,24,5,4,0, 23,24,6,4,0
data 25,28,1,4,2, 28,31,5,1,3, 28,31,6,1,3, 31,32,5,7,1, 31,32,6,7,1
Round2:
data 1,6,1,1,0, 2,6,10,1,0, 3,6,1,7,0, 4,6,10,7,0, 6,8,4,3,0
data 6,8,5,3,0, 6,8,6,3,0, 7,9,6,4,0, 7,9,4,4,0, 7,9,5,4,0
data 11,16,3,3,0, 12,16,4,3,0, 13,16,5,3,0, 14,16,6,3,0, 15,16,7,3,0
data 11,16,7,4,0, 12,16,6,4,0, 13,16,5,4,0, 14,16,4,4,0, 15,16,3,4,0
data 17,20,1,1,2, 17,20,1,7,2, 17,20,1,4,2, 17,20,10,3,4, 17,20,10,5,4
Round3:
data 1,5,5,7,1, 2,5,1,1,0, 2,5,4,1,0, 2,5,6,1,0, 2,5,10,1,0
data 5,7,5,4,0, 6,8,5,3,1, 8,10,5,5,3, 9,11,4,3,4, 7,9,6,3,2
data 10,13,5,0,3, 10,13,6,0,3, 10,13,5,8,1, 10,13,6,8,1, 15,21,1,4,0
data 15,21,10,4,0, 16,21,1,1,0, 16,21,10,7,0, 17,21,5,1,0, 17,21,5,7,0
data 18,22,1,7,0, 18,22,10,1,0, 19,22,1,4,0, 19,22,10,4,0, 20,23,5,4,0
Round4:
data 1,4,5,1,4, 1,4,6,1,2, 1,4,5,7,4, 1,4,6,7,2, 5,8,1,1,0
data 5,8,10,1,0, 6,8,1,7,0, 6,8,10,7,0, 7,10,5,4,0, 7,10,6,4,0
data 11,14,5,4,4, 11,14,6,4,2, 12,14,5,4,1, 12,14,6,4,3, 14,17,1,1,0
data 14,17,10,7,0, 15,17,10,1,0, 15,17,1,7,0, 16,18,1,4,2, 16,18,10,4,4
data 18,24,5,1,4, 18,24,6,1,2, 18,24,5,7,4, 18,24,6,7,2, 0,0,0,0,0
Round5:
data 1,5,4,4,1, 1,5,5,4,3, 1,5,6,4,1, 1,5,7,4,3, 3,7,4,4,3
data 3,7,5,4,1, 3,7,6,4,3, 3,7,7,4,1, 5,9,4,4,4, 5,9,5,4,4
data 5,9,6,4,2, 5,9,7,4,2, 7,11,4,3,3, 7,11,4,5,2, 7,11,6,3,4
data 7,11,6,5,1, 10,14,5,3,2, 10,14,5,5,1, 10,14,7,3,3, 10,14,7,5,4
data 13,16,4,3,0, 13,16,5,3,0, 13,16,6,3,0, 13,16,7,3,0, 14,16,4,5,0
data 14,16,5,5,0, 14,16,6,5,0, 14,16,7,5,0, 17,21,4,4,4, 17,21,5,4,3
data 17,21,6,4,1, 17,21,7,4,2, 20,25,1,1,2, 20,25,1,7,1, 20,25,10,1,3
data 20,25,10,7,4, 21,27,2,2,3, 21,27,2,6,2, 21,27,9,2,4, 21,27,9,6,1
data 26,32,1,0,3, 26,32,2,0,3, 26,32,3,0,3, 26,32,4,0,3, 26,32,5,0,3
data 26,32,6,0,3, 26,32,7,0,3, 26,32,8,0,3, 26,32,9,0,3, 26,32,10,0,3