mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-21 16:30:19 +00:00
107 lines
4.0 KiB
Plaintext
107 lines
4.0 KiB
Plaintext
|
4 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" THEN 10
|
||
|
9 PRINT: GOTO 6
|
||
|
10 E=200: R=1: F=0: Q=0
|
||
|
20 A=20: B=20
|
||
|
30 V=INT (RND(1)*39-R): IF V<0+R THEN 30
|
||
|
40 H=INT (RND(1)*39-R): IF H<0+R THEN 40
|
||
|
50 IF R>5 THEN 520
|
||
|
60 GR: HOME: VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R
|
||
|
65 E=E-1
|
||
|
70 COLOR=15: PLOT A,B: Q=13: GOSUB 190
|
||
|
80 Q=0: GET P$
|
||
|
90 HOME
|
||
|
100 VTAB 21: PRINT "ENERGY:";E: VTAB 21: HTAB 34: PRINT "ROOM #";R
|
||
|
110 IF P$="I" THEN COLOR=0: PLOT A,B: COLOR=15: B=B-1: PLOT A,B: E=E-1
|
||
|
120 IF P$="J" THEN COLOR=0: PLOT A,B: COLOR=15: A=A-1: PLOT A,B: E=E-1
|
||
|
130 IF P$="K" THEN COLOR=0: PLOT A,B: COLOR=15: A=A+1: PLOT A,B: E=E-1
|
||
|
140 IF P$="M" THEN COLOR=0: PLOT A,B: COLOR=15: B=B+1: PLOT A,B: E=E-1
|
||
|
150 IF B<0+R THEN GOSUB 300
|
||
|
160 IF A<0+R THEN GOSUB 300
|
||
|
170 IF A>39-R THEN GOSUB 300
|
||
|
180 IF B>39-R THEN GOSUB 300
|
||
|
190 IF A<V AND B<H THEN VTAB 23: HTAB 10: PRINT "YOU ARE IN THE COLD ZONE"
|
||
|
200 IF A>V AND B>H THEN VTAB 23: HTAB 11: PRINT "YOU ARE IN THE HOT ZONE"
|
||
|
210 IF A=V AND B=H THEN HOME: FLASH: VTAB 21: PRINT "YOU FOUND THE EXIT!!!": NORMAL: FOR I=1 TO 700: COLOR=15: PLOT A,B: COLOR=0: PLOT A,B: NEXT I: R=R+1: GOTO 30
|
||
|
215 IF Q=13 THEN RETURN
|
||
|
220 IF E<0 THEN 240
|
||
|
230 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=16 THEN G=0
|
||
|
350 NEXT I
|
||
|
360 FOR C=1 TO 4
|
||
|
370 W=A+1: X=A-1: Y=B+1: Z=B-1
|
||
|
380 PLOT A,B
|
||
|
390 COLOR=0: PLOT A,B
|
||
|
400 FOR D=1 TO 10: COLOR=G
|
||
|
410 IF W>39 THEN W=39
|
||
|
420 IF X<O THEN X=0
|
||
|
430 IF Y>39 THEN Y=39
|
||
|
440 IF Z<0 THEN 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
|
||
|
465 FOR PAUSE=1 TO 250: NEXT PAUSE
|
||
|
470 W=W+1: X=X-1: Y=Y+1: Z=Z-1
|
||
|
480 G=G+1: NEXT D
|
||
|
490 NEXT C: IF F=7 THEN RETURN
|
||
|
500 GR: GOTO 260
|
||
|
510 FOR I=1 TO 200: NEXT I
|
||
|
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: GOTO 570
|
||
|
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."
|
||
|
650 PRINT: PRINT "Each room contains an invisible door"
|
||
|
660 PRINT "you must locate to advance to the"
|
||
|
670 PRINT "next room."
|
||
|
680 PRINT: PRINT "Use the I, J, K and M keys to move"
|
||
|
690 PRINT "around the rooms."
|
||
|
700 PRINT: PRINT "PRESS ANY KEY TO CONTINUE"
|
||
|
710 GET P$: IF P$=" " THEN GOTO 720
|
||
|
720 HOME: PRINT "Each room is divided into different"
|
||
|
730 PRINT "zones:"
|
||
|
740 PRINT: PRINT "All the area ABOVE and to the LEFT of"
|
||
|
750 PRINT "the door is called the COLD ZONE."
|
||
|
760 PRINT: PRINT "All the area BELOW and to the RIGHT of"
|
||
|
770 PRINT "the door is called the HOT ZONE."
|
||
|
780 PRINT: PRINT "When you enter one of these zones, a"
|
||
|
790 PRINT "message on the screen will tell you so."
|
||
|
800 PRINT "Use this information to help you locate each door."
|
||
|
810 PRINT: PRINT "You must also beware of the DEATH ZONE,"
|
||
|
820 PRINT "which surrounds the border of each room.In each room, this zone is a little bit"
|
||
|
830 PRINT "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 "PRESS ANY KEY TO CONTINUE"
|
||
|
870 GET P$: IF P$=" " THEN GOTO 880
|
||
|
880 HOME: PRINT "You have 200 units of energy."
|
||
|
890 PRINT "Every time you move one space, one unit"
|
||
|
900 PRINT "is used up."
|
||
|
910 PRINT: PRINT "If you make it through all five rooms, you win. But if you run out of energy orenter the DEATH ZONE, the game is over."
|
||
|
920 PRINT: PRINT "Good luck!"
|
||
|
930 PRINT: PRINT "PRESS ANY KEY TO START THE GAME"
|
||
|
940 GET P$: IF P$=" " THEN GOTO 10
|
||
|
950 GOTO 10
|
||
|
|