brianMc

Lines - FreeBasic

Sep 23rd, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. screenres 640,480,32
  2.  
  3. dim as string key, msg
  4. dim as integer i, x, y, r, g, b, strt, stp, counter, total
  5.  
  6. randomize timer
  7.  
  8. strt=timer
  9. draw string ( 10,  10), "Circles displayed: 0"
  10. draw string (10,30), "Seconds elapsed: 0"
  11.  
  12. do
  13.     x = rnd * 620 + 10
  14.     y = rnd * 420 + 50
  15.     r = rnd * 255 + 20
  16.     g = rnd * 255 + 20
  17.     b = rnd * 255 + 20
  18.     circle(x,y), 10, rgb(r,g,b),,,,F
  19.     line(320,240)-(x,y),rgb(r,g,b)
  20.     sleep(50)
  21.     counter=counter+1
  22.     select case counter
  23.         case 100                   
  24.             total = total + counter
  25.            
  26.             msg = "Circles displayed: " & total
  27.             cls
  28.             draw string ( 10,  10), msg
  29.             stp = timer
  30.             draw string (10,30), "Seconds elapsed: " & stp - strt
  31.             counter = 0
  32.     end select
  33.     key=inkey  
  34. loop until key=chr(255,107)
  35. end
Add Comment
Please, Sign In to add comment