home *** CD-ROM | disk | FTP | other *** search
- 1 ' Brickout.bas By: Wayne Davison
- 10 dim b%(5,20),topnam$(11),topscr%(11),topbal%(11),w%(11)
- 20 for i%=0 to 11:read w%(i%):next i%:on error goto 50
- 30 newscore%=0:open "I",#1,"brickout.scores"
- 40 for i%=1 to 11:input#1,topnam$(i%),topscr%(i%),topbal%(i%):next i%:close #1:goto 60
- 50 for i%=1 to 11:read topnam$(i%),topscr%(i%),topbal%(i%):next i%:resume 60
- 60 audio 15,1:wave 6,w%():on error goto 0
- 70 outline 0:drawmode 0:n%=11:ask window wid%,hi%
- 80 if wid%>320 then screen 0,4,0
- 90 ask rgb 0,rs%,gs%,bs%:rgb 0,0,0,0:ask rgb 1,rs1%,gs1%,bs1%:rgb 1,5,8,13
- 100 gosub 1000:topbal%(11)=0
- 110 scnclr
- 120 pena 2:draw(0,179 to 0,0 to 302,0 to 302,179)
- 130 xss%=1:xsf%=2:yss%=2:ysf%=4
- 140 ask mouse xo%,y%,b%
- 150 pena 2:box (xo%-15,180;xo%+15,185),1
- 160 gosub 600
- 170 score%=0:ball%=0:c%=rnd(-1)
- 200 ball%=ball%+1:miss%=0:bf%=0:yv%=yss%:xv%=-xss%
- 210 get a$:if a$<>"" then 210
- 220 ?at(12,13);"Score: ";score%*5:?at(5,15);"Serving Ball: ";ball%:gosub 300
- 230 ?at(5,18);"Click the mouse or <space>.":?at(5,20);"(use <esc> to end the game)":?at(1,1);
- 240 gosub 300:get a$:if b%=0 and a$="" then 240
- 250 if a$=chr$(27) or a$="q" or a$="Q" then 700
- 260 pena 0:box (30,95;265,160),1:xp%=int(rnd*240)+20:yp%=61
- 270 drawmode 2:box(xp%-3,yp%-3;xp%+3,yp%+3),1:drawmode 0
- 280 gosub 300:gosub 400:if miss%<>1 then 280 else 200
- 300 ask mouse x%,y%,b%:d%=x%-xo%:if d%>0 then e%=15 else e%=-15
- 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
- 400 drawmode 2:box(xp%-3,yp%-3;xp%+3,yp%+3),1
- 410 for i%=1 to 4
- 420 xp%=xp%+xv%:if xp%<3 or xp%>299 then xv%=-xv%:c%=sound(2+(xp%<3),1,2,60,7000):goto 420
- 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
- 440 if yp%>200 then miss%=1:goto 580
- 450 if bf%=0 or yp%<26 or yp%>66 then 520
- 460 c%=int((xp%-2)/15):r%=int((yp%-26)/8):if b%(r%,c%)=0 then 520
- 470 b%(r%,c%)=0:yv%=-yv%:bf%=0:if r%<2 then yv%=ysf%*sgn(yv%)
- 480 drawmode 0:pena 0:box(c%*15+2,r%*8+26;c%*15+15,r%*8+32),1
- 490 c%=sound(4,1,20,40,2000+r%*400):c%=sound(8,1,20,40,2000+r%*400)
- 500 score%=score%+(5-r%):br%=br%-1:if br%=0 then gosub 600
- 510 drawmode 2
- 520 if yp%<178 or yp%>186 or abs(xp%-x%)>16 or yv%<0 then 560
- 530 c%=sound(1,1,2,50,6000):c%=sound(2,1,2,50,6000)
- 540 if abs(xp%-x%)>8 then xv%=xsf% else xv%=xss%
- 550 xv%=sgn(xp%-x%+.5)*xv%:yv%=-yv%:bf%=1:goto 430
- 560 next i%
- 570 box(xp%-3,yp%-3;xp%+3,yp%+3),1
- 580 drawmode 0:return
- 600 br%=0:for r%=0 to 4:pena r%+5
- 610 for c%=0 to 19:b%(r%,c%)=1:br%=br%+1
- 612 pena r%+5
- 620 box(c%*15+2,r%*8+26;c%*15+15,r%*8+32),1
- 622 if c% mod 4 = 0 then gosub 300
- 630 next c%:next r%
- 640 return
- 700 ball%=ball%-1:score%=score%*5:n%=11:if ball%=0 then 760 else 730
- 710 n%=n%-1:if n%=10 then 730
- 720 topnam$(n%+1)=topnam$(n%):topscr%(n%+1)=topscr%(n%):topbal%(n%+1)=topbal%(n%)
- 730 if n%>1 then if score%/ball% > topscr%(n%-1)/topbal%(n%-1) then 710
- 740 if n%>10 then 760 else scnclr:?" ";
- 750 ?at(0,5);"You made the top 10!":?:input "What's your handle";topnam$(n%):newscore%=1
- 760 topscr%(n%)=score%:topbal%(n%)=ball%
- 770 goto 100
- 800 data 100,90,60,100,90,60,-100,-90,-60,-100,-90,-60
- 810 data "Gandalf", 5000,5
- 820 data "Aragorn", 4000,5
- 830 data "Bilbo", 3000,5
- 840 data "Frodo", 2000,5
- 850 data "Samwise", 1000,5
- 860 data "Legolas", 500,5
- 870 data "Thorin", 400,5
- 880 data "Smaug", 300,5
- 890 data "Shelob", 200,5
- 900 data "Sauron", 100,5
- 910 data "(Last game)", 0,0
- 1000 scnclr
- 1010 ?at(12,2);"B R I C K O U T"
- 1020 ?at(12,4);"By: Wayne Davison"
- 1030 ?at (2,7);"No Name Score Balls Average"
- 1040 ?" == =========== ===== ===== ======="
- 1050 for i%=1 to 11:if topbal%(i%)=0 then 1090
- 1060 if i%=n% then inv%=1 else inv%=0
- 1070 if i%<11 then ? using " ##";inverse(inv%);i%; else ? inverse(inv%);" ";
- 1080 ?using " \234567890\####### ### #######.##";inverse(inv%);topnam$(i%),topscr%(i%),topbal%(i%),topscr%(i%)/topbal%(i%)
- 1090 next i%
- 1100 ?at(1,21);"Press: <space> to begin"
- 1110 ?at(11,22);"'I' for Instructions"
- 1120 ?at(5,23);"or <esc> to exit";:?at(1,1);
- 1150 ask mouse x%,y%,b%:if b%=0 then get a$:if a$="" then 1150
- 1160 if a$="i" or a$="I" then gosub 2000:goto 1000
- 1170 if a$=chr$(27) then 3000
- 1190 return
- 2000 scnclr
- 2010 ?:?" In Brick Out, you garner points for"
- 2020 ?" destroying a multi-hued brick wall"
- 2030 ?" using the ever-deadly bouncing ball."
- 2040 ?:?" You keep the ball in play and direct"
- 2050 ?" it using a mouse-controlled paddle."
- 2060 ?:?" The lowest row of bricks score 5 pts"
- 2070 ?" up to 25 points for the highest row."
- 2080 ?" The two highest rows of bricks will"
- 2090 ?" also cause the ball to speed up when"
- 2100 ?" it hits them. When the last brick"
- 2110 ?" is gone, your only reward is another"
- 2120 ?" rainbow wall, ready for destruction."
- 2130 ?:?" There is no limit to the number of"
- 2140 ?" balls you may use in each game, but"
- 2150 ?" the top-ten roster ranks your game"
- 2160 ?" on the average score per ball. The"
- 2170 ?" 'standard' game uses 5 balls."
- 2180 ?at(12,23);"<Press any key>";:?at(1,1);
- 2190 getkey a$
- 2200 scnclr
- 2210 ?:?" Feel free to give this game to any"
- 2220 ?" and all who want it. Modify it as"
- 2230 ?" much as you want (See lines 4000-"
- 2240 ?" for some modification hints). The"
- 2250 ?" game does not make use of sprites"
- 2260 ?" or collision detection, since they"
- 2270 ?" are not yet available from ABasiC."
- 2280 ?" Their presence will really smooth"
- 2290 ?" the game play in the future."
- 2300 ?:?" In the mean time, Enjoy!"
- 2310 ?:?" This game is brought to you by:"
- 2320 ?:?" Wayne Davison"
- 2330 ?:?" (No known relation to Peter Davison"
- 2340 ?" of Doctor Who fame)."
- 2350 ?at(12,23);"<Press any key>";:?at(1,1);
- 2360 getkey a$
- 2900 return
- 3000 rgb 0,rs%,gs%,bs%:rgb 1,rs1%,gs1%,bs1%
- 3010 if wid%>320 then screen 1,2,0
- 3020 scnclr:?" "
- 3100 if newscore%=0 then end
- 3110 on error goto 3140
- 3120 open "O",#1,"brickout.scores":topbal%(11)=0
- 3130 for i%=1 to 11:write#1,topnam$(i%),topscr%(i%),topbal%(i%):next i%
- 3140 close #1
- 3150 end
- 4000 ' Modification tips:
- 4010 '
- 4020 ' * For a more challenging game, change the loop in line 410
- 4030 ' from 1-4 to 1-5, or fiddle with the slow/fast x/y values
- 4040 ' in line 130.
- 4050 ' * To make the game easier(?) by hitting more bricks per ball,
- 4060 ' add the line: 475 bf%=1
- 4070 ' * To change the paddle size, you'll need to change lines
- 4080 ' 150, 300, 520, & 540.
- 4090 ' * For a game variation, add: 475 yv%=-yv%:bf%=1
- 4100 ' to check it out, or remove yv%=-yv%:bf%=0 from line 470.
- 4110 ' * To silence the game, turn the volume down, or add the
- 4120 ' line: 65 audio 15,0 which (due to a bug in ABasiC)
- 4130 ' turns off all sounds until ABasiC is restarted.
- 4140 ' * To disable the saving of the top ten score to disk, add:
- 4150 ' 35 goto 50 & 3090 end as a quick fix that is
- 4160 ' easily undone.
- 4170 '
- 4180 ' Above all, enjoy!