home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 April
/
1993-04.d64
/
baffles
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
5KB
|
145 lines
5 rem copyright 1993 - compute publications - all rights reserved
10 poke 53281,0:poke 53280,0
20 gosub 1330
30 print"[147]";:for i=1 to 10:for j=1 to 10:b(i,j)=0:next j,i
40 r=rnd(-ti):for ba=1 to 10:b=2:if rnd(1)<.5 then b=3
50 i=int(rnd(1)*10)+1:j=int(rnd(1)*10)+1:if b(i,j)<>0 then 50
60 b(i,j)=b:next ba
70 gosub 1110:ba=0:sc=0
80 cy=21:cx=15:gosub 240:print "score: 0"
90 cy=22:cx=0:gosub 240
100 print ""tab(10)"f[146] - fire laser":print tab(10)"l[146] - look for baffle"
110 print tab(10)"q[146] - quit game";
120 poke 198,0:wait 198,1:get a$
130 gs=-(a$="f")-2*(a$="l")-3*(a$="q"):on gs gosub 280,820,1380
140 gosub 1070:if gs=3 then cy=23:cx=0:gosub 240:goto 170
150 if ba<10 then goto 90
160 cy=22:cx=4:gosub240:print "[158]you've found all of the baffles!"
170 printtab(12)"play again? [y/n]":poke 198,0
180 wait 198,1:get a$:if a$="y" then 30
190 if a$<>"n" then 180
200 poke sd+24,0:end
210 rem
220 rem ***** position cursor *****
230 rem
240 poke 781,cy:poke 782,cx:poke 783,0:sys65520:return
250 rem
260 rem ***** fire laser *****
270 rem
280 gosub1070:cy=22:cx=12:gosub240:print"laser to fire: ";
290 l$="":c=0
300 print " [146][157]";
310 poke198,0:wait 198,1:get a$:if a$=chr$(13) then print " ":goto 350
320 if a$=chr$(20) and c>0 then print a$;:c=c-1:l$=left$(l$,c):goto 310
330 if a$<"0" or a$>"9" or c=2 then 310
340 print a$;:l$=l$+a$:c=c+1:goto 300
350 if l$="" then return
360 l=val(l$):if l<1 or l>40 then 280
370 sc=sc+1:if (l>10 and l<21) or l>30 then 410
380 aa=l-1:if l>20 then aa=30-l
390 xl=15+aa:yl=3:if l>20 then yl=16
400 p=55296+xl+40*yl:for i=0 to 80 step40:poke p+i,5:next:goto 440
410 aa=l-11:if l>20 then aa=40-l
420 yl=6+aa:xl=25:if l>20 then xl=12
430 p=55296+xl+40*yl:for i=0 to 2:poke p+i,5:next
440 dy=(l<31 and l>20)-(l<11)
450 dx=(l<21 and l>10)-(l>30)
460 x=1:y=41-l:if l<31 then x=31-l:y=10
470 if l<21 then x=10:y=l-10
480 if l<11 then x=l:y=1
490 fr=2000+l*100:poke sd+4,65
500 fq=fr+peek(sd+27)/2:hf=int(fq/256):lf=fqand255:poke sd,lf:poke sd+1,hf
510 b=abs(b(y,x)):if b<2 then 550
520 if dx=0 then 540
530 dy=1+2*((dx=1 and b=3) or (dx=-1 and b=2)):dx=0:goto 550
540 dx=1+2*((dy=1 and b=3) or (dy=-1 and b=2)):dy=0
550 x=x+dx:y=y+dy:if x<11 and x>0 and y<11 and y>0 then 500
560 poke sd+4,64:if y=0 then e=x
570 if x=11 then e=y+10
580 if y=11 then e=31-x
590 if x=0 then e=41-y
600 if (e>10 and e<21) or e>30 then 640
610 aa=e-1:if e>20 then aa=30-e
620 xe=15+aa:ye=3:if e>20 then ye=16
630 p=55296+xe+40*ye:for i=0 to 80 step40:poke p+i,2:next:goto 670
640 aa=e-11:if e>20 then aa=40-e
650 ye=6+aa:xe=25:if e>20 then xe=12
660 p=55296+xe+40*ye:for i=0 to 2:poke p+i,2:next
670 fr=2000+e*100:hf=int(fr/256):lf=frand255:pokesd,lf:pokesd+1,hf
680 poke sd+4,65:for t=1 to 200:next:poke sd+4,64
690 print tab(11)"exit at laser #";e
700 cy=21:cx=21:gosub240:print""sc""
710 print tab(8)"press space[146] to continue";
720 poke 198,0:wait 198,1:get a$:if a$<>" " then 720
730 c=6-8*((l/2)=int(l/2)):p=55296+xl+40*yl:if yl>3 and yl<16 then 750
740 for i=0 to 80 step 40:poke p+i,c:next:goto 760
750 for i=0 to 2:poke p+i,c:next
760 c=6-8*((e/2)=int(e/2)):p=55296+xe+40*ye:if ye>3 and ye<16 then 780
770 for i=0 to 80 step 40:poke p+i,c:next:return
780 for i=0 to 2:poke p+i,c:next:return
790 rem
800 rem ***** look for a baffle *****
810 rem
820 gosub1070:cy=22:cx=10:gosub240:print "baffle x location: ";
830 poke 198,0:wait198,1:get a$:if a$=chr$(13) then return
840 if a$<"a" or a$>"j" then 830
850 x=asc(a$)-64:print a$
860 printtab(10)"[158]baffle y location: ";
870 poke198,0:wait 198,1:get a$:if a$=chr$(13) then return
880 if a$<"a" or a$>"j" then 870
890 y=75-asc(a$):print a$
900 b=b(y,x):if b>=0 then 920
910 print" that location has already been called[146]";:poke198,0:wait198,1:return
920 sc=sc+2:cy=21:cx=21:gosub240:print""sc""
930 if b>0 then 990
940 print tab(10)"that is not a baffle[146]";:b(y,x)=-1
950 cy=y+5:cx=x+14:gosub240:print"[146]*";
960 fr=1000:forbz=0 to 10:fr=2500-fr:hf=int(fr/256):lf=frand255
970 poke sd,lf:poke sd+1,hf:pokesd+4,65:for t=1 to 5:next:poke sd+4,64:next bz
980 poke198,0:wait198,1:return
990 print tab(8)"[158]you have found a baffle![146]";:b(y,x)=-b:ba=ba+1
1000 cy=y+5:cx=x+14:gosub240:a$="[205]":if b=3 then a$="[206]"
1010 print"[158]"a$;:fr=10000:for bl=0 to 10:fr=21000-fr:hf=int(fr/256):lf=frand255
1020 pokesd,lf:pokesd+1,hf:pokesd+4,65:fort=1 to 20:next:pokesd+4,64:next bl
1030 poke198,0:wait198,1:return
1040 rem
1050 rem ***** clear screen bottom *****
1060 rem
1070 cx=0:for cy=22to24:gosub240:sys59903:next cy:return
1080 rem
1090 rem ***** draw game screen *****
1100 rem
1110 print tab(16)"[158]baffles"
1120 printtab(15)"abcdefghij"
1130 print tab(12)"[154][169] 0[154]00[154]00[154]00[154]00[154]1 [223]"
1140 print tab(12)"[154] 1[154]23[154]45[154]67[154]89[154]0 "
1150 print tab(12)"[154] [146][169][221][154][221][221][154][221][221][154][221][221][154][221][221][154][221][223] "
1160 print tab(11)"[158]j[154]40[146][192]++++++++++[192]11[158][146]j"
1170 print tab(11)"[158]i39[146][192][154]++++++++++[192]12[158][146]i"
1180 print tab(11)"[158]h[154]38[146][192]++++++++++[192]13[158][146]h"
1190 print tab(11)"[158]g37[146][192][154]++++++++++[192]14[158][146]g"
1200 print tab(11)"[158]f[154]36[146][192]++++++++++[192]15[158][146]f"
1210 print tab(11)"[158]e35[146][192][154]++++++++++[192]16[158][146]e"
1220 print tab(11)"[158]d[154]34[146][192]++++++++++[192]17[158][146]d"
1230 print tab(11)"[158]c33[146][192][154]++++++++++[192]18[158][146]c"
1240 print tab(11)"[158]b[154]32[146][192]++++++++++[192]19[158][146]b"
1250 print tab(11)"[158]a31[146][192][154]++++++++++[192]20[158][146]a"
1260 print tab(12)" [154][223][146][221][221][154][221][221][154][221][221][154][221][221][154][221][221][154][169] "
1270 print tab(12)" [154] 32[154]22[154]22[154]22[154]22 [154] "
1280 print tab(12)"[154][223] 09[154]87[154]65[154]43[154]21 [154][146][169]"
1290 printtab(15)"abcdefghij":return
1300 rem
1310 rem ***** sound setup *****
1320 rem
1330 sd=54272:for l=0to24:pokesd+l,0:next:pokesd+3,8:pokesd+5,41:pokesd+6,89
1340 poke sd+14,117:poke sd+18,16:poke sd+24,143:return
1350 rem
1360 rem ***** reveal baffles *****
1370 rem
1380 cy=6:cx=15:gosub240:print"[158]";
1390 for i=1 to 10:print tab(15);
1400 for j=1 to 10:b=b(i,j):if b<=0 then print "";:goto 1430
1410 if b=2 then print "[205]";:goto 1430
1420 if b=3 then print "[206]";
1430 next j:print:next i:return