Rem Project: User_Click Rem Created: 4/30/2007 7:24:34 PM Rem ***** Main Source File ***** `This is my entry to the DBP Apil-may 2007 challenge: Start: CLS gosub setupWindow gosub Instructions `Start Loop do gosub Mouse loop `Endloop `Subs Mouse: repeat CLS ink rgb(255,0,0),0 : box side,top,side2,bottum set text transparent ink rgb(255,255,255),0 : text 0,0,"Score: "+str$(score) if mouseclick()=1 and mousex()=>side and mousex()=<side2 and mousey()=>top and mousey()=<bottum CLS score=score+10 Side=rnd(10+550) top=rnd(10+350) side2=side+20 bottum=top+20 ink rgb(255,0,0),0 endif Elapsed=(Timer()-T)/1000 TimeLeft=Seconds-Elapsed Text 0,20,Str$(TimeLeft)+" Seconds Left" Until TimeLeft=0 if timeleft=0 CLS center text screen width()/2,20,"Your Score Was: "+str$(score) center text screen width()/2,40,"Play again? y/n" set cursor screen width()/2-40,60 : input "> ";continue$ if continue$="y" or continue$="Y" then goto Start if continue$="n" or continue$="N" then end endif return Instructions: randomize timer() set text size 24 : set text font "arial" center text screen width()/2,20,"Instructions" set text size 18 line 100,57,540,57 center text screen width()/2,70,"Click the red squares to gain points" center text screen width()/2,90,"The objective of the game is to get the highest score" center text screen width()/2,110,"Press any key to begin" line 100,140,540,140 wait key CLS Side=rnd(10+550) top=rnd(10+350) side2=side+20 bottum=top+20 ink rgb(255,0,0),0 box side,top,side2,bottum return setupWindow: T=Timer() Seconds=20: Rem change this value to alter the length of the timer score=0 set window on set window size 700,500 set window title "Apil - May 2007 DBP User reaction entry" set window position screen width()/2+150,screen height()/2+100 return