home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 April / 1993-04.d64 / baffles (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  145 lines

  1. 5 rem copyright 1993 - compute publications - all rights reserved
  2. 10 poke 53281,0:poke 53280,0
  3. 20 gosub 1330
  4. 30 print"[147]";:for i=1 to 10:for j=1 to 10:b(i,j)=0:next j,i
  5. 40 r=rnd(-ti):for ba=1 to 10:b=2:if rnd(1)<.5 then b=3
  6. 50 i=int(rnd(1)*10)+1:j=int(rnd(1)*10)+1:if b(i,j)<>0 then 50
  7. 60 b(i,j)=b:next ba
  8. 70 gosub 1110:ba=0:sc=0
  9. 80 cy=21:cx=15:gosub 240:print "score: 0"
  10. 90 cy=22:cx=0:gosub 240
  11. 100 print ""tab(10)"f[146] - fire laser":print tab(10)"l[146] - look for baffle"
  12. 110 print tab(10)"q[146] - quit game";
  13. 120 poke 198,0:wait 198,1:get a$
  14. 130 gs=-(a$="f")-2*(a$="l")-3*(a$="q"):on gs gosub 280,820,1380
  15. 140 gosub 1070:if gs=3 then cy=23:cx=0:gosub 240:goto 170
  16. 150 if ba<10 then goto 90
  17. 160 cy=22:cx=4:gosub240:print "[158]you've found all of the baffles!"
  18. 170 printtab(12)"play again? [y/n]":poke 198,0
  19. 180 wait 198,1:get a$:if a$="y" then 30
  20. 190 if a$<>"n" then 180
  21. 200 poke sd+24,0:end
  22. 210 rem
  23. 220 rem ***** position cursor *****
  24. 230 rem
  25. 240 poke 781,cy:poke 782,cx:poke 783,0:sys65520:return
  26. 250 rem
  27. 260 rem ***** fire laser *****
  28. 270 rem
  29. 280 gosub1070:cy=22:cx=12:gosub240:print"laser to fire: ";
  30. 290 l$="":c=0
  31. 300 print " [146][157]";
  32. 310 poke198,0:wait 198,1:get a$:if a$=chr$(13) then print " ":goto 350
  33. 320 if a$=chr$(20) and c>0 then print a$;:c=c-1:l$=left$(l$,c):goto 310
  34. 330 if a$<"0" or a$>"9" or c=2 then 310
  35. 340 print a$;:l$=l$+a$:c=c+1:goto 300
  36. 350 if l$="" then return
  37. 360 l=val(l$):if l<1 or l>40 then 280
  38. 370 sc=sc+1:if (l>10 and l<21) or l>30 then 410
  39. 380 aa=l-1:if l>20 then aa=30-l
  40. 390 xl=15+aa:yl=3:if l>20 then yl=16
  41. 400 p=55296+xl+40*yl:for i=0 to 80 step40:poke p+i,5:next:goto 440
  42. 410 aa=l-11:if l>20 then aa=40-l
  43. 420 yl=6+aa:xl=25:if l>20 then xl=12
  44. 430 p=55296+xl+40*yl:for i=0 to 2:poke p+i,5:next
  45. 440 dy=(l<31 and l>20)-(l<11)
  46. 450 dx=(l<21 and l>10)-(l>30)
  47. 460 x=1:y=41-l:if l<31 then x=31-l:y=10
  48. 470 if l<21 then x=10:y=l-10
  49. 480 if l<11 then x=l:y=1
  50. 490 fr=2000+l*100:poke sd+4,65
  51. 500 fq=fr+peek(sd+27)/2:hf=int(fq/256):lf=fqand255:poke sd,lf:poke sd+1,hf
  52. 510 b=abs(b(y,x)):if b<2 then 550
  53. 520 if dx=0 then 540
  54. 530 dy=1+2*((dx=1 and b=3) or (dx=-1 and b=2)):dx=0:goto 550
  55. 540 dx=1+2*((dy=1 and b=3) or (dy=-1 and b=2)):dy=0
  56. 550 x=x+dx:y=y+dy:if x<11 and x>0 and y<11 and y>0 then 500
  57. 560 poke sd+4,64:if y=0 then e=x
  58. 570 if x=11 then e=y+10
  59. 580 if y=11 then e=31-x
  60. 590 if x=0 then e=41-y
  61. 600 if (e>10 and e<21) or e>30 then 640
  62. 610 aa=e-1:if e>20 then aa=30-e
  63. 620 xe=15+aa:ye=3:if e>20 then ye=16
  64. 630 p=55296+xe+40*ye:for i=0 to 80 step40:poke p+i,2:next:goto 670
  65. 640 aa=e-11:if e>20 then aa=40-e
  66. 650 ye=6+aa:xe=25:if e>20 then xe=12
  67. 660 p=55296+xe+40*ye:for i=0 to 2:poke p+i,2:next
  68. 670 fr=2000+e*100:hf=int(fr/256):lf=frand255:pokesd,lf:pokesd+1,hf
  69. 680 poke sd+4,65:for t=1 to 200:next:poke sd+4,64
  70. 690 print tab(11)"exit at laser #";e
  71. 700 cy=21:cx=21:gosub240:print""sc""
  72. 710 print tab(8)"press space[146] to continue";
  73. 720 poke 198,0:wait 198,1:get a$:if a$<>" " then 720
  74. 730 c=6-8*((l/2)=int(l/2)):p=55296+xl+40*yl:if yl>3 and yl<16 then 750
  75. 740 for i=0 to 80 step 40:poke p+i,c:next:goto 760
  76. 750 for i=0 to 2:poke p+i,c:next
  77. 760 c=6-8*((e/2)=int(e/2)):p=55296+xe+40*ye:if ye>3 and ye<16 then 780
  78. 770 for i=0 to 80 step 40:poke p+i,c:next:return
  79. 780 for i=0 to 2:poke p+i,c:next:return
  80. 790 rem
  81. 800 rem ***** look for a baffle *****
  82. 810 rem
  83. 820 gosub1070:cy=22:cx=10:gosub240:print "baffle x location: ";
  84. 830 poke 198,0:wait198,1:get a$:if a$=chr$(13) then return
  85. 840 if a$<"a" or a$>"j" then 830
  86. 850 x=asc(a$)-64:print a$
  87. 860 printtab(10)"[158]baffle y location: ";
  88. 870 poke198,0:wait 198,1:get a$:if a$=chr$(13) then return
  89. 880 if a$<"a" or a$>"j" then 870
  90. 890 y=75-asc(a$):print a$
  91. 900 b=b(y,x):if b>=0 then 920
  92. 910 print" that location has already been called[146]";:poke198,0:wait198,1:return
  93. 920 sc=sc+2:cy=21:cx=21:gosub240:print""sc""
  94. 930 if b>0 then 990
  95. 940 print tab(10)"that is not a baffle[146]";:b(y,x)=-1
  96. 950 cy=y+5:cx=x+14:gosub240:print"[146]*";
  97. 960 fr=1000:forbz=0 to 10:fr=2500-fr:hf=int(fr/256):lf=frand255
  98. 970 poke sd,lf:poke sd+1,hf:pokesd+4,65:for t=1 to 5:next:poke sd+4,64:next bz
  99. 980 poke198,0:wait198,1:return
  100. 990 print tab(8)"[158]you have found a baffle![146]";:b(y,x)=-b:ba=ba+1
  101. 1000 cy=y+5:cx=x+14:gosub240:a$="[205]":if b=3 then a$="[206]"
  102. 1010 print"[158]"a$;:fr=10000:for bl=0 to 10:fr=21000-fr:hf=int(fr/256):lf=frand255
  103. 1020 pokesd,lf:pokesd+1,hf:pokesd+4,65:fort=1 to 20:next:pokesd+4,64:next bl
  104. 1030 poke198,0:wait198,1:return
  105. 1040 rem
  106. 1050 rem ***** clear screen bottom *****
  107. 1060 rem
  108. 1070 cx=0:for cy=22to24:gosub240:sys59903:next cy:return
  109. 1080 rem
  110. 1090 rem ***** draw game screen *****
  111. 1100 rem
  112. 1110 print tab(16)"[158]baffles"
  113. 1120 printtab(15)"abcdefghij"
  114. 1130 print tab(12)"[154][169]  0[154]00[154]00[154]00[154]00[154]1  [223]"
  115. 1140 print tab(12)"[154]   1[154]23[154]45[154]67[154]89[154]0   "
  116. 1150 print tab(12)"[154]  [146][169][221][154][221][221][154][221][221][154][221][221][154][221][221][154][221][223]  "
  117. 1160 print tab(11)"[158]j[154]40[146][192]++++++++++[192]11[158][146]j"
  118. 1170 print tab(11)"[158]i39[146][192][154]++++++++++[192]12[158][146]i"
  119. 1180 print tab(11)"[158]h[154]38[146][192]++++++++++[192]13[158][146]h"
  120. 1190 print tab(11)"[158]g37[146][192][154]++++++++++[192]14[158][146]g"
  121. 1200 print tab(11)"[158]f[154]36[146][192]++++++++++[192]15[158][146]f"
  122. 1210 print tab(11)"[158]e35[146][192][154]++++++++++[192]16[158][146]e"
  123. 1220 print tab(11)"[158]d[154]34[146][192]++++++++++[192]17[158][146]d"
  124. 1230 print tab(11)"[158]c33[146][192][154]++++++++++[192]18[158][146]c"
  125. 1240 print tab(11)"[158]b[154]32[146][192]++++++++++[192]19[158][146]b"
  126. 1250 print tab(11)"[158]a31[146][192][154]++++++++++[192]20[158][146]a"
  127. 1260 print tab(12)"  [154][223][146][221][221][154][221][221][154][221][221][154][221][221][154][221][221][154][169]  "
  128. 1270 print tab(12)" [154]  32[154]22[154]22[154]22[154]22 [154]  "
  129. 1280 print tab(12)"[154][223]  09[154]87[154]65[154]43[154]21  [154][146][169]"
  130. 1290 printtab(15)"abcdefghij":return
  131. 1300 rem
  132. 1310 rem ***** sound setup *****
  133. 1320 rem
  134. 1330 sd=54272:for l=0to24:pokesd+l,0:next:pokesd+3,8:pokesd+5,41:pokesd+6,89
  135. 1340 poke sd+14,117:poke sd+18,16:poke sd+24,143:return
  136. 1350 rem
  137. 1360 rem ***** reveal baffles *****
  138. 1370 rem
  139. 1380 cy=6:cx=15:gosub240:print"[158]";
  140. 1390 for i=1 to 10:print tab(15);
  141. 1400 for j=1 to 10:b=b(i,j):if b<=0 then print "";:goto 1430
  142. 1410 if b=2 then print "[205]";:goto 1430
  143. 1420 if b=3 then print "[206]";
  144. 1430 next j:print:next i:return
  145.