home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 1: Collection A / 17Bit_Collection_A.iso / files / 36.dms / 36.adf / brick.bas < prev    next >
BASIC Source File  |  1988-05-22  |  7KB  |  317 lines

  1. 1     ' Brickout.bas    By:  Wayne Davison
  2.  
  3. 10    dim b%(5,20),topnam$(11),topscr%(11),topbal%(11),w%(11)
  4.  
  5. 20    for i%=0 to 11:read w%(i%):next i%:on error goto 50
  6.  
  7. 30    newscore%=0:open "I",#1,"brickout.scores"
  8.  
  9. 40    for i%=1 to 11:input#1,topnam$(i%),topscr%(i%),topbal%(i%):next i%:close #1:goto 60
  10.  
  11. 50    for i%=1 to 11:read topnam$(i%),topscr%(i%),topbal%(i%):next i%:resume 60
  12.  
  13. 60    audio 15,1:wave 6,w%():on error goto 0
  14.  
  15. 70    outline 0:drawmode 0:n%=11:ask window wid%,hi%
  16.  
  17. 80    if wid%>320 then screen 0,4,0
  18.  
  19. 90    ask rgb 0,rs%,gs%,bs%:rgb 0,0,0,0:ask rgb 1,rs1%,gs1%,bs1%:rgb 1,5,8,13
  20.  
  21. 100   gosub 1000:topbal%(11)=0
  22.  
  23. 110   scnclr
  24.  
  25. 120   pena 2:draw(0,179 to 0,0 to 302,0 to 302,179)
  26.  
  27. 130   xss%=1:xsf%=2:yss%=2:ysf%=4
  28.  
  29. 140   ask mouse xo%,y%,b%
  30.  
  31. 150   pena 2:box (xo%-15,180;xo%+15,185),1
  32.  
  33. 160   gosub 600
  34.  
  35. 170   score%=0:ball%=0:c%=rnd(-1)
  36.  
  37. 200   ball%=ball%+1:miss%=0:bf%=0:yv%=yss%:xv%=-xss%
  38.  
  39. 210   get a$:if a$<>"" then 210
  40.  
  41. 220   ?at(12,13);"Score: ";score%*5:?at(5,15);"Serving Ball: ";ball%:gosub 300
  42.  
  43. 230   ?at(5,18);"Click the mouse or <space>.":?at(5,20);"(use <esc> to end the game)":?at(1,1);
  44.  
  45. 240   gosub 300:get a$:if b%=0 and a$="" then 240
  46.  
  47. 250   if a$=chr$(27) or a$="q" or a$="Q" then 700
  48.  
  49. 260   pena 0:box (30,95;265,160),1:xp%=int(rnd*240)+20:yp%=61
  50.  
  51. 270   drawmode 2:box(xp%-3,yp%-3;xp%+3,yp%+3),1:drawmode 0
  52.  
  53. 280   gosub 300:gosub 400:if miss%<>1 then 280 else 200
  54.  
  55. 300   ask mouse x%,y%,b%:d%=x%-xo%:if d%>0 then e%=15 else e%=-15
  56.  
  57. 310   pena 2:box (xo%+d%+e%,180;xo%+e%,185),1:pena 0:box (xo%+d%-e%,180;xo%-e%,185),1:xo%=x%:return
  58.  
  59. 400   drawmode 2:box(xp%-3,yp%-3;xp%+3,yp%+3),1
  60.  
  61. 410   for i%=1 to 4
  62.  
  63. 420   xp%=xp%+xv%:if xp%<3 or xp%>299 then xv%=-xv%:c%=sound(2+(xp%<3),1,2,60,7000):goto 420
  64.  
  65. 430   yp%=yp%+yv%:if yp%<3 then yv%=-yv%:bf%=1:c%=sound(1,1,2,50,7000):c%=sound(2,1,2,50,7000):goto 430
  66.  
  67. 440   if yp%>200 then miss%=1:goto 580
  68.  
  69. 450   if bf%=0 or yp%<26 or yp%>66 then 520
  70.  
  71. 460   c%=int((xp%-2)/15):r%=int((yp%-26)/8):if b%(r%,c%)=0 then 520
  72.  
  73. 470   b%(r%,c%)=0:yv%=-yv%:bf%=0:if r%<2 then yv%=ysf%*sgn(yv%)
  74.  
  75. 480   drawmode 0:pena 0:box(c%*15+2,r%*8+26;c%*15+15,r%*8+32),1
  76.  
  77. 490   c%=sound(4,1,20,40,2000+r%*400):c%=sound(8,1,20,40,2000+r%*400)
  78.  
  79. 500   score%=score%+(5-r%):br%=br%-1:if br%=0 then gosub 600
  80.  
  81. 510   drawmode 2
  82.  
  83. 520   if yp%<178 or yp%>186 or abs(xp%-x%)>16 or yv%<0 then 560
  84.  
  85. 530   c%=sound(1,1,2,50,6000):c%=sound(2,1,2,50,6000)
  86.  
  87. 540   if abs(xp%-x%)>8 then xv%=xsf% else xv%=xss%
  88.  
  89. 550   xv%=sgn(xp%-x%+.5)*xv%:yv%=-yv%:bf%=1:goto 430
  90.  
  91. 560   next i%
  92.  
  93. 570   box(xp%-3,yp%-3;xp%+3,yp%+3),1
  94.  
  95. 580   drawmode 0:return
  96.  
  97. 600   br%=0:for r%=0 to 4:pena r%+5
  98.  
  99. 610   for c%=0 to 19:b%(r%,c%)=1:br%=br%+1
  100.  
  101. 612   pena r%+5
  102.  
  103. 620   box(c%*15+2,r%*8+26;c%*15+15,r%*8+32),1
  104.  
  105. 622   if c% mod 4 = 0 then gosub 300
  106.  
  107. 630   next c%:next r%
  108.  
  109. 640   return
  110.  
  111. 700   ball%=ball%-1:score%=score%*5:n%=11:if ball%=0 then 760 else 730
  112.  
  113. 710   n%=n%-1:if n%=10 then 730
  114.  
  115. 720   topnam$(n%+1)=topnam$(n%):topscr%(n%+1)=topscr%(n%):topbal%(n%+1)=topbal%(n%)
  116.  
  117. 730   if n%>1 then if score%/ball% > topscr%(n%-1)/topbal%(n%-1) then 710
  118.  
  119. 740   if n%>10 then 760 else scnclr:?" ";
  120.  
  121. 750   ?at(0,5);"You made the top 10!":?:input "What's your handle";topnam$(n%):newscore%=1
  122.  
  123. 760   topscr%(n%)=score%:topbal%(n%)=ball%
  124.  
  125. 770   goto 100
  126.  
  127. 800   data 100,90,60,100,90,60,-100,-90,-60,-100,-90,-60
  128.  
  129. 810   data "Gandalf",  5000,5
  130.  
  131. 820   data "Aragorn",  4000,5
  132.  
  133. 830   data "Bilbo",    3000,5
  134.  
  135. 840   data "Frodo",    2000,5
  136.  
  137. 850   data "Samwise",  1000,5
  138.  
  139. 860   data "Legolas",   500,5
  140.  
  141. 870   data "Thorin",    400,5
  142.  
  143. 880   data "Smaug",     300,5
  144.  
  145. 890   data "Shelob",    200,5
  146.  
  147. 900   data "Sauron",    100,5
  148.  
  149. 910   data "(Last game)", 0,0
  150.  
  151. 1000  scnclr
  152.  
  153. 1010  ?at(12,2);"B R I C K   O U T"
  154.  
  155. 1020  ?at(12,4);"By: Wayne Davison"
  156.  
  157. 1030  ?at (2,7);"No    Name      Score Balls  Average"
  158.  
  159. 1040  ?" == ===========  ===== =====  ======="
  160.  
  161. 1050  for i%=1 to 11:if topbal%(i%)=0 then 1090
  162.  
  163. 1060  if i%=n% then inv%=1 else inv%=0
  164.  
  165. 1070  if i%<11 then ? using " ##";inverse(inv%);i%; else ? inverse(inv%);"   ";
  166.  
  167. 1080  ?using " \234567890\####### ### #######.##";inverse(inv%);topnam$(i%),topscr%(i%),topbal%(i%),topscr%(i%)/topbal%(i%)
  168.  
  169. 1090  next i%
  170.  
  171. 1100  ?at(1,21);"Press:  <space> to begin"
  172.  
  173. 1110  ?at(11,22);"'I'   for Instructions"
  174.  
  175. 1120  ?at(5,23);"or   <esc>  to exit";:?at(1,1);
  176.  
  177. 1150  ask mouse x%,y%,b%:if b%=0 then get a$:if a$="" then 1150
  178.  
  179. 1160  if a$="i" or a$="I" then gosub 2000:goto 1000
  180.  
  181. 1170  if a$=chr$(27) then 3000
  182.  
  183. 1190  return
  184.  
  185. 2000  scnclr
  186.  
  187. 2010  ?:?" In Brick Out,  you garner points for"
  188.  
  189. 2020  ?" destroying  a  multi-hued brick wall"
  190.  
  191. 2030  ?" using the ever-deadly bouncing ball."
  192.  
  193. 2040  ?:?" You keep the ball in play and direct"
  194.  
  195. 2050  ?" it using a mouse-controlled  paddle."
  196.  
  197. 2060  ?:?" The lowest row of bricks score 5 pts"
  198.  
  199. 2070  ?" up to 25 points for the highest row."
  200.  
  201. 2080  ?" The two highest rows of bricks  will"
  202.  
  203. 2090  ?" also cause the ball to speed up when"
  204.  
  205. 2100  ?" it hits them.  When the  last  brick"
  206.  
  207. 2110  ?" is gone, your only reward is another"
  208.  
  209. 2120  ?" rainbow wall, ready for destruction."
  210.  
  211. 2130  ?:?" There is  no limit  to the number of"
  212.  
  213. 2140  ?" balls you may use in each game,  but"
  214.  
  215. 2150  ?" the  top-ten roster  ranks your game"
  216.  
  217. 2160  ?" on the average score per ball.   The"
  218.  
  219. 2170  ?" 'standard' game uses 5 balls."
  220.  
  221. 2180  ?at(12,23);"<Press any key>";:?at(1,1);
  222.  
  223. 2190  getkey a$
  224.  
  225. 2200  scnclr
  226.  
  227. 2210  ?:?" Feel free to give this game to any"
  228.  
  229. 2220  ?" and all who want it.  Modify it as"
  230.  
  231. 2230  ?" much as you want  (See lines 4000-"
  232.  
  233. 2240  ?" for some modification hints).  The"
  234.  
  235. 2250  ?" game does not make use of  sprites"
  236.  
  237. 2260  ?" or collision detection, since they"
  238.  
  239. 2270  ?" are not yet available from ABasiC."
  240.  
  241. 2280  ?" Their  presence will really smooth"
  242.  
  243. 2290  ?" the game play in the future."
  244.  
  245. 2300  ?:?" In the mean time, Enjoy!"
  246.  
  247. 2310  ?:?" This game is brought to you by:"
  248.  
  249. 2320  ?:?"        Wayne Davison"
  250.  
  251. 2330  ?:?" (No known relation to Peter Davison"
  252.  
  253. 2340  ?" of Doctor Who fame)."
  254.  
  255. 2350  ?at(12,23);"<Press any key>";:?at(1,1);
  256.  
  257. 2360  getkey a$
  258.  
  259. 2900  return
  260.  
  261. 3000  rgb 0,rs%,gs%,bs%:rgb 1,rs1%,gs1%,bs1%
  262.  
  263. 3010  if wid%>320 then screen 1,2,0
  264.  
  265. 3020  scnclr:?" "
  266.  
  267. 3100  if newscore%=0 then end
  268.  
  269. 3110  on error goto 3140
  270.  
  271. 3120  open "O",#1,"brickout.scores":topbal%(11)=0
  272.  
  273. 3130  for i%=1 to 11:write#1,topnam$(i%),topscr%(i%),topbal%(i%):next i%
  274.  
  275. 3140  close #1
  276.  
  277. 3150  end
  278.  
  279. 4000  ' Modification tips:
  280.  
  281. 4010  '
  282.  
  283. 4020  '  *  For a more challenging game, change the loop in line 410
  284.  
  285. 4030  '     from 1-4 to 1-5, or fiddle with the slow/fast x/y values
  286.  
  287. 4040  '     in line 130.
  288.  
  289. 4050  '  *  To make the game easier(?) by hitting more bricks per ball,
  290.  
  291. 4060  '     add the line:  475 bf%=1
  292.  
  293. 4070  '  *  To change the paddle size, you'll need to change lines
  294.  
  295. 4080  '     150, 300, 520, & 540.
  296.  
  297. 4090  '  *  For a game variation, add:  475 yv%=-yv%:bf%=1
  298.  
  299. 4100  '     to check it out, or remove  yv%=-yv%:bf%=0  from line 470.
  300.  
  301. 4110  '  *  To silence the game, turn the volume down, or add the
  302.  
  303. 4120  '     line:  65 audio 15,0     which (due to a bug in ABasiC)
  304.  
  305. 4130  '     turns off all sounds until ABasiC is restarted.
  306.  
  307. 4140  '  *  To disable the saving of the top ten score to disk, add:
  308.  
  309. 4150  '     35 goto 50    &    3090 end     as a quick fix that is
  310.  
  311. 4160  '     easily undone.
  312.  
  313. 4170  '
  314.  
  315. 4180  ' Above all, enjoy!
  316.  
  317.