home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Game Killer
/
Game_Killer.bin
/
069.MAZERUN.BAS
< prev
next >
Wrap
BASIC Source File
|
1979-12-31
|
4KB
|
117 lines
100 '
110 'MazeRun by Randy Hawkins
120 'for ONE THOUSAND Magazine
130 '
132 COMMON RH: IF RH = 0 THEN SYSTEM
134 CLEAR: KEY (17) ON: KEY 17, CHR$(0) + CHR$(1)
136 ON KEY (17) GOSUB 1020
140 SCREEN 0: WIDTH 80: COLOR 14,0,0
150 DIM X(300), Y(300), M$(5)
160 '
170 'Prepare Screen Border
180 '
190 CLS: LOCATE 2,2,0: PRINT STRING$(77,219)
200 FOR A = 3 TO 23: LOCATE A,2: PRINT CHR$(219)
210 LOCATE A,78: PRINT CHR$(219): NEXT
220 LOCATE 24,2: PRINT STRING$(77,219);
230 '
240 'Start at Center Spot, Search for Blank
250 '
260 X = 14: Y = 40: LOCATE X,Y: PRINT CHR$(219);
270 X(0) = X: Y(0) = Y: K = 1: RANDOMIZE TIMER
280 IF SCREEN(X,Y+2) <> 219 THEN 370
290 IF SCREEN(X,Y-2) <> 219 THEN 370
300 IF SCREEN(X+2,Y) <> 219 THEN 370
310 IF SCREEN(X-2,Y) <> 219 THEN 370
320 K = K - 1: X = X(K): Y = Y(K)
330 IF K THEN 280 ELSE 530
340 '
350 'Move from Current in Random Direction
360 '
370 ON INT(RND*4)+1 GOTO 380,390,400,410
380 DX = -1: DY = 0: GOTO 420
390 DX = +1: DY = 0: GOTO 420
400 DX = 0: DY = -1: GOTO 420
410 DX = 0: DY = +1: GOTO 420
420 IF SCREEN(X+DX*2,Y+DY*2) = 219 THEN 370
430 '
440 'Draw Line from Current to Clear Spot
450 '
460 X = X + DX: Y = Y + DY: LOCATE X,Y: PRINT CHR$(219);
470 X = X + DX: Y = Y + DY: LOCATE X,Y: PRINT CHR$(219);
480 X(K) = X: Y(K) = Y: IF (K AND 7) = 0 THEN SOUND K*10,.1
490 K = K + 1: GOTO 280
500 '
510 'Scatter Targets Across Board
520 '
530 T$ = "MazeRun": L = LEN(T$): FOR A = 1 TO L
540 X = 3 + RND(1) * 21: Y = 3 + RND(1) * 74
550 IF SCREEN(X,Y) = 219 THEN 540
560 LOCATE X,Y: COLOR 11: PRINT MID$(T$,A,1);: NEXT A
570 COLOR 8: FOR A = 1 TO L: LOCATE 1, 2*A
580 PRINT MID$(T$,A,1);: NEXT A: LOCATE 1, 62
590 COLOR 15: PRINT "Time: 000 seconds"
600 '
610 'Initialize Position and Clock
620 '
630 PCOPY 0,1: K$ = CHR$(0) + "H" + CHR$(0) + "K"
640 K$ = K$ + CHR$(0) + "P" + CHR$(0) + "M": GOSUB 1200
650 M$(1) = "": M$(2) = "Begin When"
660 M$(3) = "the Rising": M$(4) = "Tone Stops"
670 M$(5) = "": GOSUB 1100: FOR A = 100 TO 800
680 SOUND A,.1: NEXT A: PCOPY 1,0: X = 13: Y = 39
690 DX = 0: DY = 0: T = TIMER: L = LEN(T$): GOTO 900
700 '
710 'Check Keyboard and Move
720 '
730 DEF SEG = 0: POKE 1050, PEEK(1052)
740 LOCATE 1,68: PRINT USING "###"; TIMER-T;
750 IF TIMER - T > 998 THEN 950
760 I$ = INKEY$: IF I$ = "" THEN 740
770 A = INSTR(K$,I$): IF A = 0 THEN 730
780 IF A = 1 THEN DX = -1: DY = 0
790 IF A = 3 THEN DX = 0: DY = -1
800 IF A = 5 THEN DX = +1: DY = 0
810 IF A = 7 THEN DX = 0: DY = +1
820 IF SCREEN(X+DX,Y+DY) = 219 THEN 730
830 IF SCREEN(X+DX,Y+DY) = 32 THEN 890
840 '
850 'Ran Over Letter, Move It Up Top
860 '
870 A$ = CHR$(SCREEN(X+DX,Y+DY)): LOCATE 1,2*INSTR(T$,A$)
880 COLOR 11,0: PRINT A$;: SOUND 1000,1: L = L - 1
890 LOCATE X,Y: COLOR 11,0: PRINT CHR$(32);
900 X = X + DX: Y = Y + DY: LOCATE X,Y: COLOR 20,7
910 PRINT CHR$(120);: COLOR 15,0: IF L THEN 730
920 '
930 'Game Over, Announce Score
940 '
950 M$(1) = "Great! You finished": M$(2) = "in only"
960 M$(2) = M$(2) + STR$(INT(TIMER-T+.5)) + " seconds!"
970 M$(3) = "": M$(4) = "Want to try this"
980 M$(5) = "maze again (Y or N)?": GOSUB 1100
990 DEF SEG = 0: POKE 1050, PEEK(1052)
1000 A$ = INKEY$: IF A$ = "Y" OR A$ = "y" THEN 650
1010 IF A$ <> "N" AND A$ <> "n" THEN 1000
1020 M$(1) = "": M$(2) = "Would you like"
1030 M$(3) = "to try a new": M$(4) = "maze (Y or N)?"
1040 M$(5) = "": GOSUB 1100: POKE 1050, PEEK(1052)
1050 A$ = INKEY$: IF A$ = "Y" OR A$ = "y" THEN 134
1060 IF A$ = "N" OR A$ = "n" THEN 1065 ELSE 1050
1065 CLS: LOCATE 12,30: PRINT "One Moment Please...": RUN "menu"
1070 '
1080 'Display Message in a Box
1090 '
1100 COLOR 0,7: FOR A=11 TO 15: LOCATE A,29
1110 PRINT STRING$(23,32);: LOCATE A,40-LEN(M$(A-10))/2
1120 PRINT M$(A-10);: NEXT A: COLOR 14,0: RETURN
1200 M$(1) = "": M$(2) = "Are you using": M$(3) = "Tandy's Enhanced"
1210 M$(4) = "Keyboard (Y or N)?": M$(5) = "": GOSUB 1100: A$ = INKEY$
1220 A$ = INKEY$: IF A$ = "N" OR A$ = "n" THEN RETURN
1230 IF A$ <> "Y" AND A$ <> "y" THEN 1220 ELSE K$ = CHR$(0) + "G"
1240 K$ = K$ + CHR$(0) + "S" + CHR$(0) + "O" + CHR$(0) + "Q"
1250 M$(1) = "On your keyboard,": M$(2) = "HOME = move up"
1260 M$(3) = "DELETE = move left": M$(4) = "END = move down"
1270 M$(5) = "PAGE UP = move right": GOSUB 1100: T = TIMER
1280 WHILE T > TIMER - 5: WEND: RETURN