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

  1. 0 rem copyright 1993 - compute publications intl ltd - all rights reserved
  2. 5 if ml=0 then ml = 1:print"[147]loading ml....":load"snakey.ml",8,1
  3. 10 qq=52232
  4. 20 :
  5. 30 gosub1010:rem "initialize
  6. 40 [141]1590
  7. 50 [141]1260:[143] "options
  8. 60 po=0
  9. 70 print"[147]":sysqq,5,08:print"press any key when ready":poke198,0:wait198,1
  10. 80 gosub880:rem "draw screen
  11. 90 ti$[178]"000000"
  12. 100 [141]210:[143] "update
  13. 110 if po=gl then goto580
  14. 120 gosub380:rem "get input
  15. 130 [141]460:[143] "check it
  16. 140 if po<>0then100
  17. 150 ct$=ti$:goto680
  18. 160 :
  19. 200 rem-update:selects and prints the next character+makes sound
  20. 210 cc=px(po):po=po+1:ifpo=glthen return
  21. 220 x=rnd(1):x=x*tl+1
  22. 230 xx=rnd(1):xx=int(xx*2)
  23. 240 ifxx=0thencc=cc+1:ifcc>22thencc=21
  24. 250 ifxx=1then  cc=cc-1:ifcc<2 thencc=3
  25. 260 px(po)=cc
  26. 270 snake$(po)=mid$(ts$,x,1)
  27. 280 sysqq,cc,po:printsnake$(po)
  28. 290 pokess+1,x+50
  29. 300 pokess+4,17:for rr= 1 to 5  :next
  30. 310 pokess+4,16
  31. 320 return
  32. 330 :
  33. 370 rem-get input:get input from player
  34. 380 r=0
  35. 390 get re$:ifre$<>""then410
  36. 400 r=r+1 :if r<>rt then390
  37. 410 return
  38. 420 :
  39. 450 rem-check it :retruns when there is wrong response or when game is over
  40. 460 if re$<>snake$(po)then   return
  41. 470 sysqq,px(po),po:print" "
  42. 480 pokess+1,po*2+22
  43. 490 pokess+4,033:for rr= 1 to 5  :next
  44. 500 pokess+4,032
  45. 510 po=po-1:if po<>0thengosub380:goto460
  46. 520 return
  47. 530 :
  48. 570 rem-lost
  49. 580 sysqq,06,12:print"[147]sorry, you lost"
  50. 590 sysqq,08,08:print"why don't you try again ??"
  51. 600 goto770
  52. 610 :
  53. 670 rem-won
  54. 680 cc$=mid$(ct$,3,2)+":"+right$(ct$,2)
  55. 690 sysqq,06,12:print"[147]you did it!
  56. 700 [158]qq,08,08:[153]"your time was : "cc$
  57. 710 [139] ct$[178][177]bt$(le) [167]770
  58. 720 [158]qq,12,0:[153]"wow!! this is a new record at level";le
  59. 730 [158]qq,15,05:[153]"what is your name ";
  60. 740 r1$[178]"  az":[141]1690
  61. 750 r1$[178]"":[158]qq,15,23,6,r1$:bp$(le)[178]r1$
  62. 760 bt$(le)[178]ct$:bb$(le)[178]cc$
  63. 770 [158]qq,20,0:[153]"press space bar to change options
  64. 780 sysqq,21,0:print"      or any other key to play again"
  65. 790 sysqq,22,0:print"      with same settings
  66. 800 [151]198,0:[146]198,1:[161] r$
  67. 810 [139] r$[178]" " [167] [153]"load":  [137]50
  68. 820 [137]60
  69. 830 :
  70. 870 [143]-draw screen
  71. 880 [158]qq,0,00:[153]"loadlevel=";le
  72. 890 [158]qq,0,12:[153]"best time ";bb$(le)
  73. 900 [158]qq,0,28:[153]"by ";bp$(le)
  74. 910 [158]qq,10,0:[153]"(NULL)"
  75. 920 [129]r[178]1[164]22:[158]qq,r ,39:[153]"(NULL)":[130]
  76. 930 [129]r [178]1[164]rs:[141]210:[130]
  77. 940 [151]198,0
  78. 950 [142]
  79. 960 :
  80. 1000 [143]-initialize
  81. 1010 [151]53280,0:[151]53281,0:
  82. 1020 [153]"" :x[178][187]([171]ti)
  83. 1030 [134] snake$(50):[143] contains the alphbets put on the screen
  84. 1040 [134]px(50)
  85. 1050 px(0)[178]10     :[143] row on which snakeof column x is put
  86. 1060 cc[178]10:[143] the current row
  87. 1070 po[178]0 :[143] the current column
  88. 1080 gl[178]39:[143] game lost
  89. 1090 s1$[178]"abcdefghijklmnopqrstuvwxyz"
  90. 1100 s2$[178]"0123456789"
  91. 1110 ts$[178]"snakey"
  92. 1120 [129] r[178] 0[164]09:bt$(r)[178]"991000":bb$(r)[178]"10:00":bp$(r)[178]"umara":[130]
  93. 1130 :
  94. 1140 [143]-sound
  95. 1150 [129] r[178]54272 [164] 54296:[151]r,0:[130]:ss[178]54272
  96. 1160 [151] ss,255
  97. 1170 [151] ss[170]24,15:[143] volume
  98. 1180 [151]ss[170]5,10[172]16[170]01:[143] att/delay
  99. 1190 [151]ss[170]6,15[172]16[170]1 :[143] sus/rel
  100. 1200 [142]
  101. 1210 :
  102. 1250 [143]-options
  103. 1260 rt[178]0
  104. 1270 [158]qq,4,4:[153]"loadchoose level (0-9)
  105. 1280 sysqq,5,4:print"(0 is easy : 9 is hard)
  106. 1290 [151]198,0:[146]198,1:[161] le$:le[178][197](le$)
  107. 1300 [139] le[178]0[167]rt[178]150:rs[178]7
  108. 1310 [139] le[178]1[167]rt[178]100:rs[178]10
  109. 1320 [139] le[178]2[167]rt[178]80:rs[178]11
  110. 1330 [139] le[178]3[167]rt[178]70:rs[178]12
  111. 1340 [139] le[178]4[167]rt[178]60:rs[178]13
  112. 1350 [139] le[178]5[167]rt[178]50:rs[178]14
  113. 1360 [139] le[178]6[167]rt[178]45:rs[178]15
  114. 1370 [139] le[178]7[167]rt[178]40:rs[178]20
  115. 1380 [139] le[178]8[167]rt[178]30:rs[178]20
  116. 1390 [139] le[178]9[167]rt[178]20:rs[178]20
  117. 1400 [139] rs[177]37 [167] rs [178] 37
  118. 1410 [139] rt[178]0[167]1290
  119. 1420 [153]:[153][163]4)le
  120. 1430 :
  121. 1440 xr[178]12:xc[178]3
  122. 1450 [158]qq,xr,xc:[153]"choose keys to be used"
  123. 1460 [158]qq,xr[170]2,xc[170]3:[153]"awaitlphabets only
  124. 1470 sysqq,xr+3,xc+3:print"n[146]umbers only
  125. 1480 [158]qq,xr[170]4,xc[170]3:[153]"bwaitoth
  126. 1490 sysqq,xr+5,xc+3:print"d[146]efined
  127. 1500 [151]198,0:[146]198,1:[161]t$
  128. 1510 [139]t$[178]"a"[167] ts$[178] s1$:[137]1580
  129. 1520 [139]t$[178]"n"[167] ts$[178] s2$:[137]1580
  130. 1530 [139]t$[178]"b"[167] ts$[178] s1$[170]s2$:[137]1580
  131. 1540 [139]t$[179][177]"d"[167] [137]1500
  132. 1550 [143]-z
  133. 1560 [153]"load":r1$[178]"!(NULL)getsin":[141]1690
  134. 1570 [153]"load":[141]1690:[158]qq,0,0,200,ts$
  135. 1580 tl[178][195](ts$):[142]
  136. 1590 [153]"load":[158]qq,0,13:[153]"s n a k e y"
  137. 1600 [153]"snakey has just come out of it's basket.
  138. 1610 print"you must help put it back in by typing
  139. 1620 [153]"the character at it's head.
  140. 1630 print"but hurry up, if snakey makes it to
  141. 1640 [153]"the wall on the other side, you will
  142. 1650 print"never be able to catch up with it!
  143. 1660 [158]qq,23,13:[153]"press any key":[151] 198,0:[146]198,1
  144. 1670 [142]
  145. 1680 [143]-xinput
  146. 1690 r1 [178] [195](r1$):[151]52940,r1[173]2
  147. 1700 [129] r2 [178] 1 [164] r1
  148. 1710 [151] 52940 [170] r2, [198]([202](r1$,r2,1))
  149. 1720 [130] r2
  150. 1730 [142]
  151.