UnderwareDESIGN

PlayBASIC => Resources => Source Codes => Topic started by: kevin on June 23, 2005, 10:00:41 PM

Title: Mouse Buster
Post by: kevin on June 23, 2005, 10:00:41 PM

[pbcode]
;===========================
; Program startup
; =============================


  Setfps 100

  Constant MaxSeconds=10

   do
 Show_INtro(MaxSeconds)  
 Play_Game(MaxSeconds)   
   loop




; =============================
; Display Intro
; =============================

Function Show_INtro(Seconds)
   cx=getscreenwidth()/2
   yh=20
   t=timer()+2000
   repeat
 Cls 0
 y=100
 ink rgb(255,255,155)
    centertext cx,y," Welcome to Mouse Buster":y=y+yh  
 ink rgb(255,255,255)
 centertext cx,y," The Aim of this game is see how many times you can click ":y=y+yh
 centertext cx,y," the left mouse button in "+str$(Seconds)+" seconds":y=y+yh
 y=y+yh
 ink rgb(155,255,255)
 centertext cx,y, "Press Left Mouse to Start"
 sync
   until timer()>t and mousebutton()=1

EndFunction



; =============================
; PLay Game
; =============================

Function Play_Game(Seconds)
   cx=getscreenwidth()/2
   yh=20
   
   repeat
 Cls 0
 inc frames   

 y=50   
 centertext cx,y,"--->>> Mouse Busting In Progress <<----": y=y+yh

 centertext cx,y," Seconds Left:"+digits$(seconds,2): y=y+yh
 y=y+yh

 Clicks=0   
 EndTime=Timer()+1000
   
    repeat
   if mousebutton()=1 and mouseclick=0
      mouseclick=1   
      inc CLicks
   else
      if mousebutton()=0
     mouseclick=0   
      endif
   endif
    until Timer()=>EndTime

    if Clicks>MAxClicks then MaxClicks=Clicks
    TotalClicks#=TotalClicks#+Clicks
   
    text cx-100,y,"        Clicks This Second:"   +str$(clicks)
    y=y+yh
    text cx-100,y,"     Max Clicks Per Second:"   +str$(maxclicks)
    y=y+yh
    text cx-100,y," Average Clicks Per Second:"   +str$(TotalClicks#/frames)
    Sync
 dec seconds
   until seconds<1


 y=y+(yh*2)
 ink rgb(255,0,0)
 centertext cx,y," ------>> Game Over <<--------"
 y=y+yh
 centertext cx,y, "Total Clicks:"+Str$(TotalClicks#)
 y=y+yh
 centertext cx,y, "Your Ranking :"+GetRank(TotalCLicks#)
 ink rgb(0,0,255)
 y=y+yh
 centertext cx,y,"<>> Press Mouse <>>"
   sync

; Wait until a few seconds and passed then allow the mouse click to
; exit
   resultstimer=timer()+4000
   Repeat
   until timer()=>resultstimer and MouseButton()=1


EndFunction


; ===============================================
; Get PLayers Rank Message
; ===============================================

Function GetRank(TotalClicks)
   if TotalCLicks<2  then  Rank$="Grand mother!"
   if TotalCLicks=>2   then   Rank$="is this thing on ?"
   if TotalCLicks=>10 then Rank$="Yawn"
   if TotalCLicks=>20 then Rank$="I can dribble faster than that"
   if TotalCLicks=>30 then Rank$="Getting better"
   if TotalCLicks=>40 then Rank$="Almost average"
   if TotalCLicks=>50 then Rank$="Average clicker"
   if TotalCLicks=>60 then Rank$="Better than average clicker"
   if TotalCLicks=>70 then Rank$="Very good"
   if TotalCLicks=>80 then Rank$="Excellent"
   if TotalCLicks=>90 then Rank$="Click Master"
   if TotalCLicks=>100 then Rank$="The ultimate Click Master"

EndFunction rank$


[/pbcode]


Title: Mouse Buster
Post by: tomazmb on June 24, 2005, 03:54:32 PM
Hello,

My best score is 62, am I good or what ? :P

Have a nice day,

Tomaz
Title: Mouse Buster
Post by: new-be-new on June 24, 2005, 07:01:18 PM
Well, youre very good but I am the GOD OF MOUSE CLICKING!!

[attachmentid=273]

Im sorry if i missplaced attachment bcause first time im sending one!
Title: Mouse Buster
Post by: mindsafe on September 29, 2005, 12:34:32 PM
Well I've got 80, not to bad :-)