remstart
   Amazing Circle VS. Clock Race Game
   Made by Sinani201
   ~The DB Classic Programming Thread~
remend
 
cls
print "Welcome to Sinani201's Amazing racing game!!!!"
print "Click the small circle to hover the big one."
print "When the big circle touches the end of the screen, you win!"
print "But if time runs out, you lose!"
print "Press any key to start. Good luck!"
wait key
goto playgame
playgame:
  cls
  radius=3
  circlexpos=456
  do
  set text opaque
    Ink RGB(255,255,255),0
    Seconds=90
    T=Timer()
    Repeat
      Elapsed=(Timer()-T)/1000
      TimeLeft=Seconds-Elapsed
      text 0,0,Str$(TimeLeft)+"   "
      position mouse mousex()+rnd(5)-2,mousey()+rnd(5)-2
      if mouseclick()=1
        mx=mousex()
        my=mousey()
        if SQRT((x-mx)^2 + (y-my)^2)<radius
          inc circleypos,19
          timer=0
        endif
      endif
      if timer=0
        cls
        x=rnd(screen width()/2)
        y=rnd(screen height())
        circle x,y,radius
        timer=200+rnd(3000)
      endif
      if circleypos=456
        gosub youwin
      endif
      dec timer
      circle circlexpos,circleypos,30
      sync
    Until TimeLeft=0
    gosub gameover
  loop
  gameover:
    cls
    print "  Sorry, time ran out. Press any key to exit"
    suspend for key
    end
  return
  youwin:
    cls
    print "Congratulations, you won! Good job."
    do
    print
loop