home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 4 / 004.d81 / madman (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  6KB  |  209 lines

  1. 1 ifx=0thenx=1:load"break.ml",8,1
  2. 5 gosub60000
  3. 10 rem this program is designed to
  4. 20 rem be a double breakout game.
  5. 30 rem the action is sideways and
  6. 40 rem there are two paddles.
  7. 50 :
  8. 60 rem the ball and the paddles
  9. 70 rem are sprites.
  10. 72 rem
  11. 75 rem*********************************
  12. 80 rem*     variable list             *
  13. 81 rem*     *************             *
  14. 82 rem*                               *
  15. 83 rem*   dx  -'x' increment ball     *
  16. 84 rem*   dy  -'y' increment ball     *
  17. 85 rem*   bx  -'x' ball position      *
  18. 86 rem*   by  -'y' ball position      *
  19. 87 rem*   ss  -sprite-sprite collision*
  20. 88 rem*   sd  -sprite-data collision  *
  21. 89 rem*   px  -'x' position paddle    *
  22. 90 rem*   py  -'y' position paddle    *
  23. 92 rem*   cc  -sys to clear wall      *
  24. 93 rem*   nb  -number of balls        *
  25. 94 rem*   sc$ -score (sc)             *
  26. 95 rem*   hs$ -hi score (hc)          *
  27. 98 rem*********************************
  28. 99 hs$="0000"
  29. 100 poke783,peek(783)and254
  30. 150 rem
  31. 200 rem
  32. 1100 rem        set up sprites
  33. 1110 rem
  34. 1120 poke2040,192
  35. 1130 poke2041,193
  36. 1135 poke2042,194
  37. 1136 poke2043,195
  38. 1137 poke2044,196
  39. 1138 poke2045,197
  40. 1140 forx=12288 to 12350:pokex,000:next
  41. 1150 forx=12352 to 12414:pokex,000:next
  42. 1152 forx=12416 to 12478:pokex,000:next
  43. 1153 forx=12480 to 12542:pokex,000:next
  44. 1154 poke12486,15:poke12487,255:poke12488,248
  45. 1155 poke12540,15:poke12541,255:poke12542,248
  46. 1160 forx=12288 to 12350 step3:pokex,192:next
  47. 1170 forx=12290 to 12350 step3:pokex,3:next
  48. 1180 poke12380,8:poke12383,28:poke12386,62:poke12389,28:poke12392,8
  49. 1185 poke12450,8
  50. 1187 forx=1to19:readloc,va:poke12480+loc,va:next
  51. 1188 forx=12544to12606:readq:pokex,q:next
  52. 1189 forx=12608to12670:readq:pokex,q:next
  53. 1190 :
  54. 1191 forx=12489to12537step3:pokex,12:pokex+2,24:next
  55. 1195 :
  56. 1200 rem initiate play
  57. 1202 :
  58. 1205 gosub31000:rem level input
  59. 1210 gosub30000:rem inti variables
  60. 1215 gosub31050:rem set up screen
  61. 1220 gosub31100:rem put sprites on
  62. 1225 :
  63. 1230 poke198,0:wait198,1
  64. 1235 sys49152
  65. 1240 ifpeek(51307)<>1then1400
  66. 1242 gosub41050
  67. 1243 sys49202
  68. 1244 goto1240
  69. 1245 :
  70. 1250 :
  71. 1275 zz=peek(v+31):zz=peek(v+30)
  72. 1300 :
  73. 1400 rem  final score and hi-score
  74. 1402 rem      for end of game.
  75. 1410 fs=peek(2018)-48-128:fs=fs*1000
  76. 1412 fs=fs+((peek(2019)-48-128)*100)
  77. 1414 fs=fs+((peek(2020)-48-128)*10)
  78. 1416 fs=fs+((peek(2021)-48-128)*1)
  79. 1420 pokev+21,0
  80. 1422 hs=peek(1995)-48-128:hs=hs*1000
  81. 1424 hs=hs+((peek(1996)-48-128)*100)
  82. 1426 hs=hs+((peek(1997)-48-128)*10)
  83. 1428 hs=hs+((peek(1998)-48-128)*1)
  84. 1430 iffs<hsthen1450
  85. 1432 poke1995,peek(2018)
  86. 1434 poke1996,peek(2019)
  87. 1436 poke1997,peek(2020)
  88. 1438 poke1998,peek(2021)
  89. 1440 hs$=right$(str$(fs),len(str$(fs))-1)
  90. 1442 iflen(hs$)<4thenz$="":forx=1to4-len(hs$):z$=z$+"0":next:hs$=z$+hs$
  91. 1450 print"[147]game over"
  92. 1451 print"final score is:";fs:iffs>hsthenprint"which is a new hi-score!!"
  93. 1452 print"want to play again (y/n)";:poke198,0:wait198,1:getz$
  94. 1454 ifz$<>"y"andz$<>"n"then1452
  95. 1456 ifz$="y"then1200
  96. 1458 :
  97. 1460 print"[147]        * * * * the end * * * *"
  98. 1500 poke646,peek(53281):print"load"chr$(34)"payload"chr$(34)",8"
  99. 1502 print"run"
  100. 1505 poke631,13:poke632,13:poke198,2:end
  101. 1600 :
  102. 10000 data13,62,16,99,19,193,20,128,22,193,23,128,25,193,26,128,28,1,29,128
  103. 10002 data31,1,32,128,34,3,37,30,40,24,43,24,46,24,52,24,55,24
  104. 10005 :
  105. 10010 data1,255,224,3,0,48,6,0,24,12,0,12,24,192,198,24,192,198
  106. 10012 data24,0,6,24,12,6,24,30,6,24,63,6,24,0,6,24,0,6,25,0,38,27,000,54
  107. 10013 data25,128,102
  108. 10014 data12,127,140,6,30,24,3,0,48,1,255,224,0,0,0,0,0,0
  109. 10015 :
  110. 10020 data1,255,224,3,192,240,6,97,152
  111. 10022 data12,51,12,24,30,6,24,192,198
  112. 10024 data24,192,198,24,0,6,24,0,6
  113. 10026 data24,12,6,24,30,6,24,63,6,24,0,6,24,0,6
  114. 10028 data24,30,6,24,51,6,25,192,230
  115. 10030 data12,128,76,6,0,24,3,0,48,1,255,224
  116. 30000 rem variable init.
  117. 30005 v=53248:zz=peek(v+30):zz=peek(v+31)
  118. 30020 nb=6
  119. 30030 sc$="0000"
  120. 30040 px=158:py=100
  121. 30050 bx=100:by=100
  122. 30060 dx=2:dy=2
  123. 30070 poke783,peek(783)and254
  124. 30080 return
  125. 30085 :
  126. 31000 rem level input
  127. 31005 print"[147]level (0-20)";:inputlv:iflv<0orlv>20then31005
  128. 31010 poke53000,lv+5
  129. 31020 return
  130. 31025 :
  131. 31050 rem
  132. 31055 rem    set up screen
  133. 31060 rem
  134. 31065 print"[147]";:poke53281,0:poke53280,7
  135. 31070 forx=0to23
  136. 31075 print" [209][156][209][209][209][146]";tab(35)"[209][209][156][209][209]"
  137. 31080 nextx
  138. 31085 print" [158]                                      ";
  139. 31086 poke783,peek(783)and254
  140. 31090 poke781,24:poke782,02:sys65520
  141. 31095 print"hi-score:"hs$;"   balls:";nb;" score:"sc$;
  142. 31097 print"[146]"
  143. 31098 return
  144. 31099 :
  145. 31100 rem put sprites on the screen
  146. 31105 pokev+23,0:pokev+29,1
  147. 31110 pokev,px:pokev+1,py
  148. 31115 pokev+2,bx:pokev+3,by
  149. 31120 pokev+4,bx:pokev+5,by
  150. 31125 pokev+6,168:pokev+7,130
  151. 31130 pokev+8,168:pokev+9,68
  152. 31135 pokev+10,168:pokev+11,192
  153. 31140 pokev+21,63:poke646,0:pokev+31,0
  154. 31142 forc=39to44:pokev+c,1:next
  155. 31143 pokev+44,7:pokev+43,5
  156. 31145 return
  157. 31150 :
  158. 41050 rem
  159. 41055 rem    redraw screen
  160. 41060 rem
  161. 41065 print"";
  162. 41067 forll=217to242:pokell,peek(ll)or128:next
  163. 41070 forx=0to23
  164. 41075 print" [209][156][209][209][209][146]";tab(35)"[209][209][156][209][209]"
  165. 41080 nextx
  166. 41085 poke783,peek(783)and254
  167. 41086 poke781,24:poke782,02:sys65520
  168. 41087 print"[158]hi-score:";"   balls:";" score:[146]";
  169. 41098 return
  170. 60000 poke783,peek(783)and254
  171. 60001 print"[147]":poke53281,0:poke53280,2
  172. 60002 poke781,peek(781)and254
  173. 60005 hb=0:he=39
  174. 60010 vb=0:ve=22:a$="[209]"
  175. 60015 :
  176. 60020 forx=hbtohestep6:poke781,vb:poke782,x:sys65520:printa$:next
  177. 60030 fory=vbtovestep6:poke781,y:poke782,he:sys65520:printa$:next
  178. 60040 forx=hetohbstep-6:poke781,ve:poke782,x:sys65520:printa$:next
  179. 60050 fory=vetovbstep-6:poke781,y:poke782,hb:sys65520:printa$:next
  180. 60060 hb=hb+1:he=he-1
  181. 60070 vb=vb+1:ve=ve-1
  182. 60080 ifhb=23andhe=16then61000
  183. 60090 goto60020
  184. 60095 :
  185. 61000 poke781,11:poke782,14:sys65520
  186. 61005 print"        [157][157][157][157][157][157][157][157]        [157][157][157][157][157][157][157][157]        "
  187. 61010 poke781,12:poke782,16:sys65520:print"madman"
  188. 61015 poke781,23:poke782,13:sys65520:print"<press a key>"
  189. 61020 poke198,0:wait198,1:print"[147]madman":print
  190. 61025 print"  by":print
  191. 61030 print"alan w. gardner":print:print:print
  192. 61035 print" adapted from an idea from tom spidell"
  193. 61040 poke781,23:poke782,13:sys65520:print"<press a key>"
  194. 61045 poke198,0:wait198,1
  195. 61050 print"[147] this game is very similar to most of":print
  196. 61055 print"the old 'breakout' games.  the object ":print
  197. 61060 print"of the game is to knock down as much of":print
  198. 61065 print"the wall as possible with the ball.":print
  199. 61070 print" try to avoid mr. mad because he will ":print
  200. 61080 print"eat your ball!!":print
  201. 61085 print" mr. happy is o.k. to run into because":print
  202. 61090 print"he will let your ball pass on by.":print
  203. 61095 print" the question mark is o.k. sometimes,":print
  204. 61100 print"but deadly at other times.":print
  205. 61105 print" the paddles are controlled by a joy-":print
  206. 61110 print"stick in port #2."
  207. 61120 poke781,23:poke782,10:sys65520:print"<press a key to play>"
  208. 61125 poke198,0:wait198,1:return
  209.