home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 April
/
1993-04.d64
/
snakey
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
151 lines
0 rem copyright 1993 - compute publications intl ltd - all rights reserved
5 if ml=0 then ml = 1:print"[147]loading ml....":load"snakey.ml",8,1
10 qq=52232
20 :
30 gosub1010:rem "initialize
40 [141]1590
50 [141]1260:[143] "options
60 po=0
70 print"[147]":sysqq,5,08:print"press any key when ready":poke198,0:wait198,1
80 gosub880:rem "draw screen
90 ti$[178]"000000"
100 [141]210:[143] "update
110 if po=gl then goto580
120 gosub380:rem "get input
130 [141]460:[143] "check it
140 if po<>0then100
150 ct$=ti$:goto680
160 :
200 rem-update:selects and prints the next character+makes sound
210 cc=px(po):po=po+1:ifpo=glthen return
220 x=rnd(1):x=x*tl+1
230 xx=rnd(1):xx=int(xx*2)
240 ifxx=0thencc=cc+1:ifcc>22thencc=21
250 ifxx=1then cc=cc-1:ifcc<2 thencc=3
260 px(po)=cc
270 snake$(po)=mid$(ts$,x,1)
280 sysqq,cc,po:printsnake$(po)
290 pokess+1,x+50
300 pokess+4,17:for rr= 1 to 5 :next
310 pokess+4,16
320 return
330 :
370 rem-get input:get input from player
380 r=0
390 get re$:ifre$<>""then410
400 r=r+1 :if r<>rt then390
410 return
420 :
450 rem-check it :retruns when there is wrong response or when game is over
460 if re$<>snake$(po)then return
470 sysqq,px(po),po:print" "
480 pokess+1,po*2+22
490 pokess+4,033:for rr= 1 to 5 :next
500 pokess+4,032
510 po=po-1:if po<>0thengosub380:goto460
520 return
530 :
570 rem-lost
580 sysqq,06,12:print"[147]sorry, you lost"
590 sysqq,08,08:print"why don't you try again ??"
600 goto770
610 :
670 rem-won
680 cc$=mid$(ct$,3,2)+":"+right$(ct$,2)
690 sysqq,06,12:print"[147]you did it!
700 [158]qq,08,08:[153]"your time was : "cc$
710 [139] ct$[178][177]bt$(le) [167]770
720 [158]qq,12,0:[153]"wow!! this is a new record at level";le
730 [158]qq,15,05:[153]"what is your name ";
740 r1$[178]" az":[141]1690
750 r1$[178]"":[158]qq,15,23,6,r1$:bp$(le)[178]r1$
760 bt$(le)[178]ct$:bb$(le)[178]cc$
770 [158]qq,20,0:[153]"press space bar to change options
780 sysqq,21,0:print" or any other key to play again"
790 sysqq,22,0:print" with same settings
800 [151]198,0:[146]198,1:[161] r$
810 [139] r$[178]" " [167] [153]"load": [137]50
820 [137]60
830 :
870 [143]-draw screen
880 [158]qq,0,00:[153]"loadlevel=";le
890 [158]qq,0,12:[153]"best time ";bb$(le)
900 [158]qq,0,28:[153]"by ";bp$(le)
910 [158]qq,10,0:[153]"(NULL)"
920 [129]r[178]1[164]22:[158]qq,r ,39:[153]"(NULL)":[130]
930 [129]r [178]1[164]rs:[141]210:[130]
940 [151]198,0
950 [142]
960 :
1000 [143]-initialize
1010 [151]53280,0:[151]53281,0:
1020 [153]"" :x[178][187]([171]ti)
1030 [134] snake$(50):[143] contains the alphbets put on the screen
1040 [134]px(50)
1050 px(0)[178]10 :[143] row on which snakeof column x is put
1060 cc[178]10:[143] the current row
1070 po[178]0 :[143] the current column
1080 gl[178]39:[143] game lost
1090 s1$[178]"abcdefghijklmnopqrstuvwxyz"
1100 s2$[178]"0123456789"
1110 ts$[178]"snakey"
1120 [129] r[178] 0[164]09:bt$(r)[178]"991000":bb$(r)[178]"10:00":bp$(r)[178]"umara":[130]
1130 :
1140 [143]-sound
1150 [129] r[178]54272 [164] 54296:[151]r,0:[130]:ss[178]54272
1160 [151] ss,255
1170 [151] ss[170]24,15:[143] volume
1180 [151]ss[170]5,10[172]16[170]01:[143] att/delay
1190 [151]ss[170]6,15[172]16[170]1 :[143] sus/rel
1200 [142]
1210 :
1250 [143]-options
1260 rt[178]0
1270 [158]qq,4,4:[153]"loadchoose level (0-9)
1280 sysqq,5,4:print"(0 is easy : 9 is hard)
1290 [151]198,0:[146]198,1:[161] le$:le[178][197](le$)
1300 [139] le[178]0[167]rt[178]150:rs[178]7
1310 [139] le[178]1[167]rt[178]100:rs[178]10
1320 [139] le[178]2[167]rt[178]80:rs[178]11
1330 [139] le[178]3[167]rt[178]70:rs[178]12
1340 [139] le[178]4[167]rt[178]60:rs[178]13
1350 [139] le[178]5[167]rt[178]50:rs[178]14
1360 [139] le[178]6[167]rt[178]45:rs[178]15
1370 [139] le[178]7[167]rt[178]40:rs[178]20
1380 [139] le[178]8[167]rt[178]30:rs[178]20
1390 [139] le[178]9[167]rt[178]20:rs[178]20
1400 [139] rs[177]37 [167] rs [178] 37
1410 [139] rt[178]0[167]1290
1420 [153]:[153][163]4)le
1430 :
1440 xr[178]12:xc[178]3
1450 [158]qq,xr,xc:[153]"choose keys to be used"
1460 [158]qq,xr[170]2,xc[170]3:[153]"awaitlphabets only
1470 sysqq,xr+3,xc+3:print"n[146]umbers only
1480 [158]qq,xr[170]4,xc[170]3:[153]"bwaitoth
1490 sysqq,xr+5,xc+3:print"d[146]efined
1500 [151]198,0:[146]198,1:[161]t$
1510 [139]t$[178]"a"[167] ts$[178] s1$:[137]1580
1520 [139]t$[178]"n"[167] ts$[178] s2$:[137]1580
1530 [139]t$[178]"b"[167] ts$[178] s1$[170]s2$:[137]1580
1540 [139]t$[179][177]"d"[167] [137]1500
1550 [143]-z
1560 [153]"load":r1$[178]"!(NULL)getsin":[141]1690
1570 [153]"load":[141]1690:[158]qq,0,0,200,ts$
1580 tl[178][195](ts$):[142]
1590 [153]"load":[158]qq,0,13:[153]"s n a k e y"
1600 [153]"snakey has just come out of it's basket.
1610 print"you must help put it back in by typing
1620 [153]"the character at it's head.
1630 print"but hurry up, if snakey makes it to
1640 [153]"the wall on the other side, you will
1650 print"never be able to catch up with it!
1660 [158]qq,23,13:[153]"press any key":[151] 198,0:[146]198,1
1670 [142]
1680 [143]-xinput
1690 r1 [178] [195](r1$):[151]52940,r1[173]2
1700 [129] r2 [178] 1 [164] r1
1710 [151] 52940 [170] r2, [198]([202](r1$,r2,1))
1720 [130] r2
1730 [142]