home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Home Entertainment Cube … Strategy Shareware Games
/
STRATEGY.ISO
/
trap
/
trap.bas
< prev
next >
Wrap
BASIC Source File
|
1993-08-22
|
9KB
|
179 lines
10 DEFINT A-Z: KEY OFF: SCREEN 0, 0, 0: PLAY "MB"
20 MM = 4: DIM LNAME$(20), LSCORE(20)
30 '
40 '---PRINT INSTRUCTIONS
50 '
60 COLOR 3, 0: PRINT "Welcome to TRAP Version 2 -- now in color"
70 PRINT "Would you like instructions?"; : GOSUB 1660
80 IF A$ = "N" THEN 320
90 PRINT : PRINT "You ("; : COLOR 2, 0: PRINT "@"; : COLOR 3, 0: PRINT ") can move in eight directions using the cursor pad."
100 PRINT "As you move you turn the doors ("; : COLOR 7, 0: PRINT "▄ ▌ ▐ ▀";
110 COLOR 3, 0: PRINT ") attached to the immovable hinges ("; : COLOR 0, 7: PRINT "■"; : COLOR 3, 0: PRINT ")."
120 PRINT "The object is to trap the monsters ("; : COLOR 4, 0: PRINT CHR$(15); : COLOR 3, 0: PRINT ") between four doors like this:"
130 PRINT
140 PRINT " "; : COLOR 0, 7: PRINT "■"; : COLOR 7, 0: PRINT "▌"; : COLOR 0, 7: PRINT "■"; : COLOR 7, 0: PRINT
150 PRINT " ▄"; : COLOR 4, 0: PRINT CHR$(15); : COLOR 7, 0: PRINT "▀"
160 PRINT " "; : COLOR 0, 7: PRINT "■"; : COLOR 7, 0: PRINT "▐"; : COLOR 0, 7: PRINT "■"; : COLOR 7, 0: PRINT
170 PRINT
180 COLOR 3, 0: PRINT "The monsters are harmless and there is no way to die in this game. However, if"
190 PRINT "you touch them, or hit them with a door you move, they will teleport away."
200 PRINT
210 PRINT "The object of the game is to trap all four monsters as quickly as possible."
201 PRINT "Press Q to quit the game at any time."
220 PRINT
230 PRINT "This game is now freeware. Author:"
240 PRINT " Bruce Brandt"
250 PRINT " 13 - 27th Ave SE"
260 PRINT " Minneapolis, MN 55414-3101"
270 PRINT
280 PRINT "Type any key to continue": GOSUB 1660
290 '
300 '---START OF GAME: RANDOMIZE; PRINT DOORS, PLAYER, MONSTERS
310 '
320 RANDOMIZE VAL(MID$(TIME$, 4, 2)) * 7 - VAL(RIGHT$(TIME$, 2)) * 43
330 CLS : COLOR 7, 0
340 PRINT " ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ";
350 PRINT " ▐ ▌ ▐ ▐ ▐ ▐ ▌ ▐ ▐ ▌ ▐ ▐ ▐ ▐ ▌ ▌ ▐ ▐ ▐ ▌ ▌ ";
360 PRINT " ▄ ▄ ▀ ▄ ▄ ▀ ▄ ▄ ▀ ▀ ▄ ▀ ▀ ▄ ▄ ▀ ▀ ▄ ▀ ";
370 PRINT " ▐ ▐ ▐ ▌ ▌ ▐ ▐ ▐ ▐ ▌ ▌ ▌ ▐ ▐ ▌ ▌ ▐ ▌ ▌ ▌ ▌ ";
380 PRINT " ▄ ▀ ▄ ▄ ▄ ▀ ▄ ▄ ▄ ▄ ▀ ▀ ▀ ▄ ▀ ▀ ▀ ";
390 PRINT " ▐ ▌ ▐ ▌ ▌ ▐ ▌ ▐ ▌ ▌ ▐ ▐ ▐ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ▌ ";
400 PRINT " ▀ ▀ ▀ ▄ ▀ ▄ ▀ ▀ ▄ ▄ ▄ ▀ ▀ ▄ ▀ ▄ ";
410 PRINT "▐ ▌ ▐ ▌ ▌ ▐ ▌ ▌ ▌ ▐ ▐ ▐ ▐ ▌ ▌ ▐ ▌ ▌ ▌ ▐ ▌ ▐ ";
420 PRINT " ▀ ▄ ▀ ▄ ▄ ▀ ▀ ▄ ▀ ▀ ▄ ▄ ▀ ▀ ▄ ▄ ▄ ▀ ▄ ▀ ";
430 PRINT " ▌ ▌ ▐ ▌ ▌ ▐ ▐ ▌ ▌ ▌ ▌ ▌ ▐ ▐ ▌ ▌ ▌ ▐ ▌ ▐ ▐ ▌ ▌ ▌ ▌ ";
440 PRINT " ▀ ▄ ▄ ▄ ▄ ▀ ▄ ▄ ▄ ▄ ▀ ▀ ▄ ▄ ▄ ▄ ";
450 PRINT "▐ ▐ ▐ ▐ ▐ ▌ ▌ ▌ ▌ ▐ ▐ ▌ ▌ ▐ ▐ ▌ ▐ ▐ ▐ ▐ ▌ ";
460 PRINT " ▄ ▄ ▄ ▄ ▀ ▄ ▀ ▄ ▄ ▄ ▀ ▀ ▄ ▀ ▀ ▄ ▄ ";
470 PRINT " ▐ ▌ ▐ ▐ ▌ ▐ ▐ ▌ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▐ ▌ ▌ ";
480 PRINT " ▀ ▄ ▀ ▄ ▄ ▄ ▄ ▀ ▀ ▀ ▀ ▄ ▄ ▄ ▀ ▀ ";
490 PRINT " ▌ ▌ ▌ ▐ ▌ ▌ ▌ ▐ ▌ ▌ ▌ ▌ ▌ ▌ ▐ ▐ ▐ ▌ ▌ ▐ ▐ ";
500 PRINT " ▄ ▄ ▀ ▀ ▄ ▀ ▄ ▄ ▄ ▄ ▀ ▄ ▀ ▀ ▀ ▀ ▀ ▄ ▄ ▀ ";
510 PRINT " ▐ ▌ ▌ ▌ ▌ ▐ ▐ ▌ ▐ ▌ ▌ ▌ ▌ ▐ ▐ ▐ ▐ ▌ ▐ ";
520 PRINT " ▄ ▄ ▀ ▀ ▀ ▄ ▀ ▄ ▄ ▄ ▀ ▄ ▀ ▀ ▄ ▄ ▀ ▀ ▀ ";
530 PRINT "▐ ▌ ▌ ▐ ▌ ▌ ▌ ▐ ▐ ▌ ▐ ▐ ▐ ▌ ▌ ▐ ▐ ▐ ";
540 PRINT " ▄ ▀ ▄ ▀ ▀ ▄ ▄ ▄ ▀ ▀ ▀ ▀ ▄ ▄ ▀ ▄ ▀ ▀ ▀ ▀ ▄ ";
550 PRINT " ▌ ▐ ▐ ▌ ▐ ▌ ▌ ▐ ▐ ▐ ▌ ▌ ▐ ▐ ▌ ▌ ▐ ▐ ▐ ▐ ";
560 PRINT " ▀ ▀ ▄ ▄ ▄ ▀ ▄ ▄ ▀ ▀ ▀ ▄ ▄ ▄ ▀ ▀ ▀ ▀ ▄ ▄ ";
570 PRINT " ▐ ▐ ▌ ▐ ▌ ▌ ▌ ▐ ▐ ▌ ▐ ▐ ▐ ▌ ▐ ▐ ▐ ▌ ▌ ";
580 LOCATE 25, 1
590 PRINT " ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ▀ ";
600 COLOR 0, 7: FOR X = 2 TO 24 STEP 2: FOR Y = 2 TO 78 STEP 2
610 LOCATE X, Y: PRINT "■"; : NEXT Y: NEXT X
620 '
630 X = 2 * INT(RND * 13) + 1
640 Y = 2 * INT(RND * 40) + 1
650 LOCATE X, Y: COLOR 26, 0: PRINT "@"; : COLOR 7, 0
660 '
670 FOR MI = 1 TO MM: GOSUB 1320: NEXT MI
680 SCORE = 0
690 '
700 '---MAIN LOOP: SEE WHETHER MONSTERS OR PLAYER MOVES
710 '
720 A$ = INKEY$: IF A$ = "" AND T$ = TIME$ THEN 720
721 IF UCASE$(A$) = "Q" THEN CLS : END
730 IF T$ <> TIME$ THEN T$ = TIME$: GOSUB 1090
740 IF A$ <> "" THEN GOSUB 790
750 GOTO 720
760 '
770 '---SUBROUTINE: PLAYER MOVES
780 '
790 XD = 0: YD = 0
800 IF LEFT$(A$, 1) = CHR$(0) THEN A$ = MID$(A$, 2) ELSE 890
810 IF A$ = "G" THEN XD = -1: YD = -1
820 IF A$ = "H" THEN XD = -1:
830 IF A$ = "I" THEN XD = -1: YD = 1
840 IF A$ = "K" THEN YD = -1
850 IF A$ = "M" THEN YD = 1
860 IF A$ = "O" THEN XD = 1: YD = -1
870 IF A$ = "P" THEN XD = 1
880 IF A$ = "Q" THEN XD = 1: YD = 1
890 IF XD = 0 AND YD = 0 THEN PLAY "L64N40N41N42": RETURN
900 IF X + XD < 1 OR X + XD > 25 OR Y + YD < 1 OR Y + YD > 79 THEN PLAY "L64N10N17N24": RETURN
910 IF (X + XD) MOD 2 = 0 AND (Y + YD) MOD 2 = 0 THEN PLAY "L64N30N44N30": RETURN
920 LOCATE X, Y: PRINT " "; : XT = X: YT = Y: X = X + XD: Y = Y + YD: F$ = "@": GOSUB 960: RETURN
930 '
940 '---SUBROUTINE: DOORS MOVE
950 '
960 XT = XT + XD: YT = YT + YD: C = SCREEN(XT, YT): LOCATE XT, YT
970 IF F$ = "@" THEN COLOR 2, 0: PRINT F$; : COLOR 7, 0: ELSE PRINT F$;
980 IF C = 32 THEN RETURN
990 IF C = 220 THEN XD = 1: IF YD = -1 THEN F$ = "▐" ELSE F$ = "▌"
1000 IF C = 221 THEN YD = -1: IF XD = -1 THEN F$ = "▄" ELSE F$ = "▀"
1010 IF C = 222 THEN YD = 1: IF XD = -1 THEN F$ = "▄" ELSE F$ = "▀"
1020 IF C = 223 THEN XD = -1: IF YD = -1 THEN F$ = "▐" ELSE F$ = "▌"
1030 IF C <> 15 THEN 960
1040 FOR MI = 1 TO MM: IF MX(MI) = XT AND MY(MI) = YT THEN GOSUB 1320: RETURN
1050 NEXT MI
1060 '
1070 '---SUBROUTINE: MONSTERS MOVE
1080 '
1090 MA = 0: FOR MI = 1 TO MM
1100 XT = MX(MI): YT = MY(MI)
1110 IF XT > 1 THEN MF(1) = SCREEN(XT - 1, YT) ELSE MF(1) = 0
1120 IF XT < 25 THEN MF(2) = SCREEN(XT + 1, YT) ELSE MF(2) = 0
1130 IF YT > 1 THEN MF(3) = SCREEN(XT, YT - 1) ELSE MF(3) = 0
1140 IF YT < 79 THEN MF(4) = SCREEN(XT, YT + 1) ELSE MF(4) = 0
1150 IF MF(1) = 2 OR MF(2) = 2 OR MF(3) = 2 OR MF(4) = 2 THEN GOSUB 1320: GOTO 1220
1160 IF MF(1) <> 32 AND MF(2) <> 32 AND MF(3) <> 32 AND MF(4) <> 32 THEN 1250
1170 MC = INT(RND * 4) + 1: IF MF(MC) <> 32 THEN 1170
1180 IF MC = 1 THEN MX(MI) = XT - 1
1190 IF MC = 2 THEN MX(MI) = XT + 1
1200 IF MC = 3 THEN MY(MI) = YT - 1
1210 IF MC = 4 THEN MY(MI) = YT + 1
1220 MA = 1
1230 LOCATE XT, YT: PRINT " ";
1240 LOCATE MX(MI), MY(MI): COLOR 4, 0: PRINT CHR$(15); : COLOR 7, 0
1250 NEXT MI
1260 IF MA = 0 THEN 1400
1270 SCORE = SCORE + 1
1280 RETURN
1290 '
1300 '---SUBROUTINE: MONSTERS TELEPORT
1310 '
1320 MX(MI) = 2 * INT(RND * 13) + 1
1330 MY(MI) = 2 * INT(RND * 40) + 1
1340 IF SCREEN(MX(MI), MY(MI)) <> 32 THEN 1320
1350 LOCATE MX(MI), MY(MI): COLOR 4, 0: PRINT CHR$(15); : COLOR 7, 0: PLAY "L32N83N6"
1360 RETURN
1370 '
1380 '---END OF GAME: DISPLAY TIME ELAPSED, TOP SCORES
1390 '
1400 CLS : COLOR 3, 0: LOCATE 3, 5: PRINT "Game over. Elapsed time is "; SCORE; "seconds."
1410 LOCATE 5: PRINT "These were the top players:"
1420 ON ERROR GOTO 1730
1430 OPEN "TRAP.TOP" FOR INPUT AS #1
1440 INPUT #1, NTOP
1450 FOR I = 1 TO NTOP: INPUT #1, LSCORE(I), LNAME$(I): NEXT I
1460 CLOSE #1
1470 ON ERROR GOTO 0
1480 FOR I = 1 TO NTOP: PRINT I; ")", LSCORE(I), LNAME$(I): NEXT I
1490 FOR I = 1 TO NTOP: IF SCORE < LSCORE(I) THEN 1510
1500 NEXT I: PRINT "Your score does not rank.": GOTO 1590
1510 FOR II = NTOP TO I + 1 STEP -1: LSCORE(II) = LSCORE(II - 1): LNAME$(II) = LNAME$(II - 1): NEXT II
1520 IF INKEY$ <> "" THEN 1520
1530 INPUT "What is your name"; LNAME$(I): LSCORE(I) = SCORE
1540 CLS : LOCATE 5: PRINT "These are the new top players:"
1550 FOR I = 1 TO NTOP: PRINT I; ")", LSCORE(I), LNAME$(I): NEXT I
1560 OPEN "TRAP.TOP" FOR OUTPUT AS #1: WRITE #1, NTOP
1570 FOR I = 1 TO NTOP: WRITE #1, LSCORE(I), LNAME$(I): NEXT I
1580 CLOSE #1
1590 PRINT "Would you like to play again?";
1600 GOSUB 1660
1610 IF A$ = "Y" THEN 330
1620 COLOR 7, 0: END
1630 '
1640 '---SUBROUTINE: GET RESPONSE
1650 '
1660 A$ = INKEY$: IF A$ = "" THEN 1660
1670 IF A$ = "y" THEN A$ = "Y"
1680 IF A$ = "n" THEN A$ = "N"
1690 RETURN
1700 '
1710 '---ERROR TRAP IF NO SCORES FILE
1720 '
1730 NTOP = 15
1740 FOR I = 1 TO NTOP: LSCORE(I) = 30000: LNAME$(I) = "---": NEXT I
1750 RESUME 1470