jsbasic/samples/sample.doordetector.txt

98 lines
3.7 KiB
Plaintext

4 PR# 0:TEXT: HOME
5 HTAB 15: INVERSE: PRINT "DOOR DETECTOR": NORMAL
6 PRINT: PRINT: PRINT "DO YOU WANT INSTRUCTIONS? Y/N"
7 GET P$: IF P$="Y" THEN 610
8 IF P$<>"N" GOTO 7
10 E=200: R=1: F=0: Q=0
20 A=RND(-PEEK(79)*999-PEEK(78)): A=20: B=20
30 FOR I=1 TO 2: V=H: H=INT (RND(1)*(40-R*2))+R: NEXT
40 REM Line 50: If prior room's exit was next to Death Zone, you'd now be IN Death Zone — step out of it!
50 A=(A<R)-(A>39-R)+A: B=(B<R)-(B>39-R)+B
60 GR: HOME: VTAB 21: PRINT "ENERGY:";E;: HTAB 34: PRINT "ROOM #";R
65 E=E-1
70 COLOR=15: PLOT A,B: Q=13: GOSUB 180
80 Q=0: FOR I=0 TO 128: I=PEEK(49152): NEXT: POKE 49168,0: I=I - 203: I=I-(I>21) * 32
90 HOME
100 VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R
110 IF SGN(I)=I OR I=3 THEN COLOR=0: PLOT A,B: COLOR=15: A=(I=1)+A-NOT I: B=INT(I/3)+B: PLOT A,B: E=E-1
150 IF B<R OR A<R OR A>39-R OR B>39-R THEN GOSUB 300
180 IF (A-V) * (B-H) > 0 THEN VTAB 23: I=A>V: HTAB I+10: PRINT "YOU ARE IN THE " MID$("COLDHOT",I*4 + 1,4) " ZONE"
190 ON A<>V OR B<>H GOTO 220:IF Q=13 THEN POP
200 HOME: FLASH: PRINT "YOU FOUND THE EXIT!!!": NORMAL
210 Q=15:FOR I=1 TO 20: COLOR=Q: PLOT A,B: Q=15-Q: FOR C=1 TO 300: NEXT C,I: R=R+1: ON R/2 GOTO 30,30,520
220 IF Q=13 THEN RETURN
230 IF E>=0 GOTO 80
240 HOME: INVERSE: VTAB 21: PRINT "YOU RAN OUT OF ENERGY": NORMAL
250 F=7: GOSUB 310
260 FOR PAUSE=1 TO 5000: NEXT PAUSE
270 HOME: VTAB 21: PRINT "THE DOOR WAS IN THE RED AREA"
280 COLOR=1: PLOT V,H
290 GOTO 570
300 HOME: INVERSE: VTAB 21: PRINT "YOU HAVE ENTERED THE DEATH ZONE": NORMAL
310 FOR I=1 TO 250
320 COLOR=G
330 PLOT A,B
340 G=G+1: IF G>15 THEN G=0
350 NEXT I
360 FOR C=1 TO 4
370 W=A: X=A: Y=B: Z=B
380 COLOR=0: PLOT A,B
390 FOR D=1 TO 10: COLOR=G
400 W=(W<39)+W: X=X-(X>0): Y=(Y<39)+Y: Z=Z-(Z>0)
450 PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z
455 FOR PAUSE=1 TO 250: NEXT PAUSE
460 COLOR=0: PLOT W,B: PLOT X,B: PLOT A,Y: PLOT A,Z
470 FOR PAUSE=1 TO 250: NEXT PAUSE
480 G=(G+1) * (G<15): NEXT D
490 NEXT C: IF F=7 THEN RETURN
500 GR: GOTO 260
520 TEXT: HOME
530 PRINT "WELL DONE!"
540 PRINT: PRINT "YOU HAVE ESCAPED FROM ALL FIVE ROOMS"
550 PRINT "SUCCESSFULLY, WITH ";E;" UNITS OF"
560 PRINT "ENERGY LEFT.": PRINT
570 PRINT "WANT TO PLAY AGAIN? Y/N"
580 GET A$: IF A$="Y" THEN 10
590 IF A$="N" THEN PRINT: PRINT "SO LONG!": END
600 PRINT CHR$(7);: GOTO 580
610 HOME
620 PRINT "The object of this game is to escape"
630 PRINT "from a series of five rooms before you"
640 PRINT "run out of energy. Each room contains"
650 PRINT "an invisible door you must locate to"
660 PRINT "advance to the next room."
680 PRINT: PRINT "Use the I, J, K and M keys to move"
690 PRINT "around the rooms."
700 PRINT: PRINT "Each room is made up of different zones:"
710 PRINT "All the area ABOVE and to the LEFT of"
720 PRINT "the door is called the COLD ZONE."
730 PRINT: PRINT "All the area BELOW and to the RIGHT of"
740 PRINT "the door is called the HOT ZONE."
750 PRINT: PRINT "When you enter one of these zones, a"
760 PRINT "message on the screen will tell you so."
770 PRINT "Use this information to help you locate each door."
780 VTAB 24: PRINT "PRESS ANY KEY TO CONTINUE ";
790 GET P$
800 HOME: PRINT "You must also beware of the invisible"
810 PRINT "DEATH ZONE, which surrounds the border"
820 PRINT "of each room. In each room, this zone isa little bit wider than in the previous room."
840 PRINT: PRINT "If you ever enter this zone, the game"
850 PRINT "will end immediately!"
860 PRINT: PRINT "You have 200 units of energy."
870 PRINT "Every time you move one space, one unit"
880 PRINT "is used up."
890 PRINT: PRINT "If you make it through all five rooms,"
900 PRINT "you win. But if you run out of energy orenter the DEATH ZONE, the game is over."
920 PRINT: PRINT "Good luck!"
930 VTAB 23: PRINT "PRESS ANY KEY TO START THE GAME ";
940 GET P$: GOTO 10