home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 14 / 014.d81 / wormshot (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1985-01-01  |  10.1 KB  |  352 lines

  1. 10 rem:newmid$dim***error***runinput***error***step***error***input***error***to***error***stepon***error***left$tan***error******error***/***error***
  2.  
  3.  
  4.  
  5. jjjjval***error******error******error***on***error***stepE***error***input***error******error******error******error***fn***error***right$***error******error***fn***error***right$def***error******error***stopleft${$60}:
  6. 20 poke 2109,217: poke828,0
  7. 80 gosub1190:rem*** title screen ******
  8. 90 gosub2540:nm=25:dimmt(nm,2)
  9. 100 rd=1: poke53280,0:poke53281,0:print"":dl=5: gosub440:t=rnd(-ti)
  10. 110 hd=1076+40*lp :tl=1064+40*lp :bg=0
  11. 120 rem *** move worm *****************
  12. 130 ifhd>1883orwh>11then390
  13. 140 pokehd,81:poketl,32:tl=tl+1:gosub160:hd=hd+1:goto130
  14. 150 rem *** move bullet ***************
  15. 160 ifnotbgthengetfr$:bl=1924
  16. 170 iffr$=" "thenbg=-1:goto210
  17. 180 iffr$<>"_" then200
  18. 190 gett$:ift$="" then190
  19. 200 fort=1to12:nextt:return
  20. 210 bl=bl-40:ifbl=1044thenbg=0:pokebl+40,32:poke198,0:return
  21. 220 pokebl,66:pokebl+40,32:gosub240:return
  22. 230 rem *** check for hit *************
  23. 240 ifbl<tlthenreturn
  24. 250 ifbl>hdthenreturn
  25. 260 wh=wh+1:lg=(hd-tl>2):hh=bl>(hd-1)
  26. 270 if(bl=tl)andlgthen bn=-1:print"  bonus 50 points for hitting tail!    "
  27. 280 ifhhandlgthenpokebl,32:bn=-1:print"        a  shot  to  the  head !       "
  28. 290 if not bn then360
  29. 300 ifbl=tlthen330
  30. 310 fore=tltohd:pokee,32:nexte:hd=hd-40:tl=tl-40:fore=tltohd-1:pokee,81:nexte
  31. 320 pokebl,32:bl=hd:goto340
  32. 330 th=th+1:ts=ts+50
  33. 340 gosub1610:gosub430
  34. 350 bn=0:gosub940
  35. 360 bg=0:pokebl,32:poketl,32:tl=tl+1:ts=ts+hd-bl:print"score:"ts
  36. 370 poke198,0:return
  37. 380 :
  38. 390 fort=tltohd-1:poket,32:nextt: lp=lp+1: pokebl,32:gosub600
  39. 400 ifsp<125 then1100
  40. 410 goto110
  41. 420 return
  42. 430 print"                                       ":poke198,0:return
  43. 440 rem *********** buildings toppings*
  44. 450 tp(1)=88:tp(2)=86:tp(3)=87:tp(4)=88:    tp(5)=90:tp(6)=102:tp(7)=127
  45. 460 rem **************** draw city ****
  46. 470 for t = 1 to 40 : pc=1983+t
  47. 480 ifrnd(1)*2<1thenpokepc,102:pokepc+54272,3:poke pc-40,tp(int(rnd(1)*7)+1)
  48. 490 poke pc+54232,int(rnd(1)*15)+1
  49. 500 next t
  50. 510 poke2004,214: poke1964,66
  51. 520 fort=0to80 step40:poket+56196,7:        nextt
  52. 530 if nn then return
  53. 540 if peek(828)=120 then580
  54. 550 gosub2790:gosub1820
  55. 560 print"": fort=1 to 16:print"                                      ":nextt
  56. 570 print""
  57. 580 sys2055: gosub430: gosub3300
  58. 590 gosub2480: sys828: gosub940: return
  59. 600 rem meteor shower *****************
  60. 610 i%=rd/2:if((rd/2-id)=0) then dl=dl-1:ifdl<1thendl=1
  61. 620 gosub430
  62. 630 sys956:t=rnd(-ti):if peek(1624)=32 then710
  63. 640 print"     defense too great for meteors!!!        bonus 200 points."
  64. 650 ts=ts+200:fort=1to1800:nextt
  65. 660 print"                                                              "
  66. 670 ms=0
  67. 680 wh=0:gosub970: ifsp<124 then return
  68. 690 if ms then gosub3310
  69. 700 gosub930:gosub2480:sys828: return
  70. 710 gosub3440: print"        warning! meteor shower": as=0 : poke198,0
  71. 720 poke1022,129:poke1020,128:poke1021,137: poke1023,0
  72. 730 poke54296,10
  73. 740 for ct=1 to nm
  74. 750 mt(ct,1)=int(rnd(1)*40)+1424
  75. 760 mt(ct,2)=int(rnd(1)*6)+1
  76. 770 next ct
  77. 780 mo=0
  78. 790 for mc=1 to nm : sys828
  79. 800 m1=mt(mc,1):m2=mt(mc,2)
  80. 810 pokem1,32
  81. 820 ifm1<1984thenmt(mc,1)=mt(mc,1)+40:m1=m1+40:p=peek(m1):goto840
  82. 830 pokem1,32:goto890
  83. 840 if(p<>32)thenmt(mc,2)=mt(mc,2)-1:ifp<>61thenpoke53281,2:gosub1730
  84. 850 if mt(mc,2)<1 then830
  85. 860 pokem1,42
  86. 870 if m2=0 then830
  87. 880 goto800
  88. 890 sys956:next mc
  89. 900 print"                      "
  90. 910 gosub2480:ms=-1: goto680
  91. 920 rem *** print status line ***
  92. 930 if(peek(198)>1) thenpoke198,1
  93. 940 print"score:"ts" tails hit:"th" round:"rd
  94. 950 return
  95. 960 rem *************** city bonus
  96. 970 gosub430: print"score:"ts
  97. 980 print"tabulating survival points": sp=0
  98. 990 fort=1984to2023
  99. 1000 if peek(t)<>32 then sp=sp+10:print"";sp
  100. 1010 nextt
  101. 1020 fort=1944to1983
  102. 1030 if peek(t)<>32 then sp=sp+15: print"";sp
  103. 1040 nextt:ts=ts+sp
  104. 1050 fort=1to1600:nextt
  105. 1060 print"                 "
  106. 1070 print"                          "
  107. 1080 print"         "
  108. 1090 gosub430:gosub2980:rd=rd+1:sys2055:return
  109. 1100 rem ************ ending message **
  110. 1110 sys956:print"your survival quotient of"sp"is "
  111. 1120 print"not enough to continue your battle."
  112. 1130 print"your score was"ts
  113. 1140 gosub2690: gosub2790
  114. 1150 poke198,0: print"do you want to play again?(y/n)"
  115. 1160 gett$:ift$="" then1160
  116. 1170 ift$="y" then ts=0:lp=0:th=0:t=rnd(-ti):goto100
  117. 1180 print"":goto63000
  118. 1190 rem *********title screen ********
  119. 1200 poke53280,0:poke53281,0:print"":       rem *** put title screen here
  120. 1210 print"{CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+}   {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+}{CBM-+}{CBM-+}"
  121. 1220 print"{CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+} {CBM-+}{CBM-+} {CBM-+}   {CBM-+} {CBM-+} {CBM-+} {CBM-+}  {CBM-+}"
  122. 1230 print"{CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}  {CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+} {CBM-+}  {CBM-+}"
  123. 1240 print"{CBM-+}{CBM-+} {CBM-+}{CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+}   {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+}  {CBM-+}"
  124. 1250 print"{CBM-+}   {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}{CBM-+} {CBM-+} {CBM-+} {CBM-+}{CBM-+}{CBM-+}  {CBM-+}"
  125. 1260 print"             by joe garrett"
  126. 1270 print"copyright 1985"
  127. 1280 print"      loadstar is not public domain"
  128. 1290 print"   please respect the author's rights"
  129. 1300 print"   do you need instructions?(y/n)"
  130. 1310 sys2055 : fort=1 to 10: nextt
  131. 1320 gett$:ift$="" then1310
  132. 1330 poke2109,219:print""
  133. 1340 if t$<>"y" then return
  134. 1350 print"         *** instructions ***        "
  135. 1360 nn=-1:gosub440:nn=0
  136. 1380 printchr$(142)"use space bar to fire shots one at a"
  137. 1390 print"time at an advancing worm:QQQQQQQ. more"
  138. 1400 print"points are scored by hitting him toward"
  139. 1410 print"his tail, with a bonus for hitting it."
  140. 1420 print"if his head is hit then he is knocked"
  141. 1430 print"back a row. destroy him before he "
  142. 1440 print"reaches your defense wall so that you"
  143. 1460 print"can protect your city from the impend-"
  144. 1470 print"ing meteor storm. if an equivalent of"
  145. 1520 print"five buildings remain after a storm,"
  146. 1530 print"survival points are added up and the "
  147. 1540 print"worm attacks again, from one position"
  148. 1542 print"lower. every seventh round you survive,"
  149. 1544 print"you'll get a bonus building for each "
  150. 1546 print"time you hit the tail. the '_' key will"
  151. 1548 print"pause an attacking worm in case of    "
  152. 1549 print"phone, snack needed, etc.":print
  153. 1550 print"         fire tower{SHIFT-*}I  city buildings"
  154. 1560 print"hit a key to start{CBM-A}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{SHIFT-*}{CBM-S}"
  155. 1565 poke198,0
  156. 1570 gets$:ifs$="" then1570
  157. 1580 return
  158. 1590 rem tail sound routine ***********
  159. 1600 :
  160. 1610 s=54279
  161. 1620 poke s+6,240
  162. 1630 poke s+4,17
  163. 1640 for a=1 to 10
  164. 1650 for x= 1 to 255  step 25
  165. 1660 poke s+1,x/2
  166. 1670 next x
  167. 1680 next a
  168. 1690 poke s+4,16
  169. 1700 return
  170. 1710 rem meteor crash sound ***********
  171. 1720 :
  172. 1730 s=54279
  173. 1740 poke s+1,14
  174. 1750 poke s+5,3
  175. 1760 poke s+6,255-15
  176. 1770 poke s+4,17
  177. 1780 for d=1 to 31step5:e=e+1:pokes+1,40-d:pokes+4,17:next d
  178. 1790 poke s+4,16: poke53281,0
  179. 1800 return
  180. 1810 rem ------- irq music maker -------
  181. 1820 i=828: if(peek(i)=120)then2480
  182. 1830 print"wait..."
  183. 1840 read a:if a=256 then2060
  184. 1850 poke i,a:i=i+1:goto1840
  185. 1860 data 120,173,20,3,141,46,3,173
  186. 1870 data 21,3,141,47,3,169,107,141
  187. 1880 data 20,3,169,3,141,21,3,32
  188. 1890 data 88,3,88,96,173,252,3,133
  189. 1900 data 253,173,253,3,133,254,169,0
  190. 1910 data 133,182,169,0,133,169,96,165
  191. 1920 data 169,240,15,198,169,208,8,173
  192. 1930 data 254,3,41,254,141,4,212,108
  193. 1940 data 46,3,165,182,240,5,198,182
  194. 1950 data 108,46,3,160,0,177,253,201
  195. 1960 data 255,240,39,141,1,212,200,177
  196. 1970 data 253,141,0,212,200,177,253,133
  197. 1980 data 169,24,165,253,105,3,133,253
  198. 1990 data 144,2,230,254,173,254,3,141
  199. 2000 data 4,212,173,255,3,133,182,108
  200. 2010 data 46,3,32,88,3,76,107,3
  201. 2020 data 120,173,254,3,41,254,141,4
  202. 2030 data 212,173,46,3,141,20,3,173
  203. 2040 data 47,3,141,21,3,169,0,141
  204. 2050 data 0,212,141,1,212,88,96,256
  205. 2060 rem ------- your program --------
  206. 2070 rem ------ continues here -------
  207. 2080 s=54272:forl=stos+24:pokel,0:nextl
  208. 2090 fort=35000to35180
  209. 2100 readn:poket,n:nextt: goto2430
  210. 2110 data 12,143,24, 14,239,17
  211. 2120 data 12,143,10,  12,143,3
  212. 2130 data 16,195,10,  12,143,10
  213. 2140 data 11,48,10
  214. 2150 data 12,143,24, 18,209,17
  215. 2160 data 12,143,10,  12,143,4
  216. 2170 data 19,239,10,  18,209,10
  217. 2180 data 14,239,10,  12,143,10
  218. 2190 data 18,209,10,  25,30,10
  219. 2200 data 12,143,4 ,  11,48,10
  220. 2210 data 11,48, 4,   9,104,10
  221. 2220 data 14,24,10,   12,143,24
  222. 2230 data 4,180,10,   4,180,17
  223. 2240 data 4,180,10,   4,180,4
  224. 2250 data 4,48,10,    3,187,10
  225. 2260 data 3,134,10
  226. 2270 data 12,143,24, 14,239,17
  227. 2280 data 12,143,10,  12,143,4
  228. 2290 data 16,195,10,  12,143,10
  229. 2300 data 11,48,10
  230. 2310 data 12,143,24, 18,209,17
  231. 2320 data 12,143,10,  12,143,4
  232. 2330 data 19,239,10,  18,209,10
  233. 2340 data 14,239,10,  12,143,10
  234. 2350 data 18,209,10,  25,30,10
  235. 2360 data 12,143,4 ,  11,48,10
  236. 2370 data 11,48,4 ,   9,104,10
  237. 2380 data 14,24,10,   12,143,24
  238. 2390 data 50,60,10,   50,60,18
  239. 2400 data 50,60,10,   50,60,10
  240. 2410 data 50,60, 4,   50,60,10
  241. 2420 data 50,60,10,   255
  242. 2430 rem music continued **************
  243. 2440 fort=35200to35298 step3
  244. 2450 poket,int(rnd(1)*40+10):poket+1,int(rnd(1)*230+12):poket+2,1:nextt
  245. 2460 poke 35299,255
  246. 2470 rem reset theme music ************
  247. 2480 poke1020,184: poke1021,136
  248. 2490 poke1022,33
  249. 2500 poke1023,dl
  250. 2510 poke 54277,8  : poke54278,8
  251. 2520 poke54296,12: return
  252. 2530 rem****** get hi-scores *********
  253. 2540 open2,8,2,"0:worm scores,s,r"
  254. 2550 open15,8,15:input#15,a$
  255. 2560 ifa$="62"thenfort=1to10:nm$(t)="---":sc(t)=1500:nextt:close2:gosub2630:return
  256. 2570 for t = 1 to 10
  257. 2580 input#2,nm$(t),sc(t)
  258. 2590 next t : close2
  259. 2600 close15
  260. 2610 return
  261. 2620 rem ***** write hi-scores ********
  262. 2630 open5,8,5,"@0:worm scores,s,w"
  263. 2640 for t=1 to 10
  264. 2650 print#5,nm$(t)","sc(t)
  265. 2660 next t : close 5
  266. 2670 return
  267. 2680 rem ****** check for high score **
  268. 2690 if ts<sc(10) then return
  269. 2700 sc(10) = ts:gosub2860:nm$(10)=nm$:      rem sort scores *****
  270. 2710 sw=0: for t=9 to 1 step -1
  271. 2720 if sc(t)<sc(t+1) then sw=-1:            gosub2760
  272. 2730 next t: if sw then2710
  273. 2740 gosub2630
  274. 2750 return
  275. 2760 tp=sc(t) : sc(t)=sc(t+1):               sc(t+1)=tp
  276. 2770 tn$=nm$(t) : nm$(t)=nm$(t+1):           nm$(t+1)=tn$ : return
  277. 2780 rem **** display high scores *****
  278. 2790 print"     *** wormshot hall of fame ***     "
  279. 2800 print"                                      "
  280. 2810 for t=1 to 10
  281. 2820 print"           "nm$(t)"        "sc(t)
  282. 2830 next t
  283. 2840 return
  284. 2850 rem ****** input initials *******
  285. 2860 print"   your score of"ts"entitles you to"
  286. 2870 print"enter your initials in the wormshot"
  287. 2880 print"hall of fame!   {CBM-@}{CBM-@}{CBM-@}";
  288. 2890 print"";:nm$="":for t=1 to 3
  289. 2900 get i$:ifi$="" then2900
  290. 2910 printi$;:nm$=nm$+i$
  291. 2920 next t: print: if len(nm$)<>3 then c$="2":goto2950
  292. 2930 print"are they correct? (y/n)"
  293. 2940 getc$: if c$="" then2940
  294. 2950 if c$<>"y" then print"                             ":goto2860
  295. 2960 return
  296. 2970 rem *** 7th round survival bonus *
  297. 2980 if(rd<>7andrd<>14andrd<>21andrd<>28)    or sp<125 then return
  298. 2990 poke1022,17:poke1020,128:poke1021,137:poke1023,7:poke54278,255
  299. 3000 poke54296,15 :poke54277,0  :sys828
  300. 3010 gosub430
  301. 3020 print"      congratulations,"rd"th round"
  302. 3030 print"survivor! one bonus building for"
  303. 3040 print"every tail hit!"
  304. 3050 fort=55456 to 55655 step3:poket,int(rnd(1)*15)+1:nextt
  305. 3060 ifpeek(1964)=32then th=th-1:            poke2004,214: poke1964,66:gosub3200
  306. 3070 ifth<1 then3120
  307. 3072 mb=0:fort=1984to2023:ifpeek(t)=32thenmb=mb+1
  308. 3075 nextt:ifth>mb then th=mb-1
  309. 3080 forq=1 to th
  310. 3090 w=int(rnd(1)*39)+1984
  311. 3100 ifpeek(w)=32 then gosub3170:            next q: goto3120
  312. 3110 goto3090
  313. 3120 th=0:fort=1 to 1500: nextt
  314. 3130 print"                              "
  315. 3140 print"                                 "
  316. 3150 print"                        "
  317. 3160 lp=2*(rd/7):sys956:dl=5:return
  318. 3170 poke w,102:pokew-40,20:gosub3200: return
  319. 3180 rem new building sound
  320. 3190 :
  321. 3200 s=54279
  322. 3210 poke s+1,14
  323. 3220 poke s+5,3
  324. 3230 poke s+6,255-15
  325. 3240 poke s+24,15
  326. 3250 poke s+4,17
  327. 3260 for d=11 to180step22:pokes+1,d :pokes+4,33 :pokes+1,80+d:pokes+4,17: next d
  328. 3270 poke s+4,16
  329. 3280 fort=1to600:nextt
  330. 3290 return
  331. 3300 rem *** build wall ***************
  332. 3310 gosub430:print"*** defense screen up! ***":lw=1864:rw=1863:p=61
  333. 3320 for t=1 to 20
  334. 3330 for s=lw to lw-240 step-40
  335. 3340 pokes,61
  336. 3350 next s : if t=20 then p=32
  337. 3360 for u=rw to rw-240 step-40
  338. 3370 pokeu,p
  339. 3380 next u
  340. 3390 lw=lw+1: rw=rw-1
  341. 3400 next t :poke1884,32
  342. 3410 gosub430:return
  343. 3420 :
  344. 3430 rem *** restore gun protection ***
  345. 3440 for t=1923 to 1483 step-40
  346. 3450 if peek(t)=61 then poke t+1,61
  347. 3460 next t : return
  348. 3470 gosub2540:ts=5000: sp=15:goto1110
  349. 63000 rem  connect back to loadstar
  350. 63010 print"load"chr$(34)"hello"          chr$(34)",8":print"run"
  351. 63020 poke631,13:poke632,13:poke198,2:        end
  352.