Skip to content
Game 10 Unit 15 of 16 1 hr learning time

Five Floors and Polish

Expand to five floors, add a title screen, floor intros, border colours, and a victory sequence.

94% of Night Patrol

Three floors prove the system works. Five floors make it a complete game. This unit adds two more floors, a title screen with a building silhouette, floor intro text, border colours that change per floor, and a proper victory sequence.

The Program

10 BORDER 0: PAPER 0: INK 7: CLS
15 GO SUB 900
20 DIM m$(8, 16)
30 LET v = 3: LET e = 0: LET l = 1
35 DIM b(5): LET b(1) = 1: LET b(2) = 5: LET b(3) = 4: LET b(4) = 6: LET b(5) = 3
40 RESTORE 1000
50 REM load floor
55 BORDER b(l)
60 FOR i = 1 TO 8
70 READ m$(i)
80 NEXT i
90 READ r, c, g, h, d$, o, p, w, x
100 LET q = 1: LET t = 0: LET s = 20 - l * 3: LET f$ = d$(1 TO 1)
110 LET j = 0
120 CLS
125 PRINT AT 10, 5; INK 7; "Floor "; l
126 PAUSE 40
130 CLS: GO SUB 800
135 PRINT AT o + 2, p + 2; INK 6; "*"
136 PRINT AT w + 2, x + 2; INK 1; "X"
140 GO SUB 870
150 REM game loop
155 GO SUB 700
160 PRINT AT r + 2, c + 2; INK 7; BRIGHT 1; "@"
170 PRINT AT g + 2, h + 2; INK 2; "G"
180 LET t = t + 1
190 LET k$ = INKEY$
200 IF k$ = "" THEN GO TO 240
210 LET u = r: LET i = c
212 IF k$ = "q" THEN LET u = r - 1
214 IF k$ = "a" THEN LET u = r + 1
216 IF k$ = "o" THEN LET i = c - 1
218 IF k$ = "p" THEN LET i = c + 1
220 IF u < 1 OR u > 8 OR i < 1 OR i > 16 THEN GO TO 240
222 IF m$(u)(i TO i) = "#" THEN GO TO 240
224 PRINT AT r + 2, c + 2; " "
226 LET r = u: LET c = i
228 IF r = o AND c = p AND j = 0 THEN LET j = 1: BEEP 0.1, 20: PRINT AT w + 2, x + 2; INK 4; "X": GO SUB 870
230 IF r = w AND c = x AND j = 1 THEN GO TO 550
240 IF t < s THEN GO TO 320
250 LET t = 0
255 GO SUB 760
260 PRINT AT g + 2, h + 2; " "
270 LET f$ = d$(q TO q)
280 IF f$ = "N" THEN LET g = g - 1
290 IF f$ = "S" THEN LET g = g + 1
300 IF f$ = "W" THEN LET h = h - 1
310 IF f$ = "E" THEN LET h = h + 1
315 LET q = q + 1: IF q > LEN d$ THEN LET q = 1
320 IF r = g AND c = h THEN GO TO 400
330 GO TO 150
400 REM detected
405 GO SUB 760
410 LET v = v - 1
415 PRINT AT g + 1, h + 2; INK 2; BRIGHT 1; "!"
420 BEEP 0.05, 30: BEEP 0.05, 25
425 BORDER 2: PAUSE 5: BORDER 0: PAUSE 3
430 BORDER 2: PAUSE 5: BORDER b(l)
435 BEEP 0.1, 20: BEEP 0.15, 15
440 PRINT AT g + 1, h + 2; " "
445 IF v = 0 THEN GO TO 500
460 PRINT AT g + 2, h + 2; " "
470 PRINT AT r + 2, c + 2; " "
480 RESTORE 1000: FOR i = 1 TO (l - 1) * 9 + 8: READ a$: NEXT i: READ r, c, g, h, d$, o, p, w, x
490 LET q = 1: LET f$ = d$(1 TO 1): LET t = 0
495 GO SUB 870: GO TO 150
500 CLS: BORDER 0
510 PRINT AT 8, 9; INK 2; "GAME OVER"
520 PRINT AT 10, 8; "Score: "; e
525 PRINT AT 11, 8; "Floor: "; l
530 BEEP 0.15, 0: BEEP 0.15, -3: BEEP 0.2, -7
540 STOP
550 REM floor complete
560 LET e = e + 10 * l
565 GO SUB 760
570 BEEP 0.15, 12: BEEP 0.15, 16: BEEP 0.3, 19
580 PRINT AT 12, 5; INK 4; "FLOOR "; l; " COMPLETE!"
590 PAUSE 50
600 LET l = l + 1
610 IF l > 5 THEN GO TO 650
620 GO TO 50
650 REM victory
660 CLS: BORDER 0
670 PRINT AT 6, 8; INK 4; "YOU ESCAPED!"
680 PRINT AT 8, 8; "Score: "; e
685 PRINT AT 10, 5; INK 7; "All floors cleared!"
690 BEEP 0.15, 12: BEEP 0.15, 16: BEEP 0.15, 19: BEEP 0.15, 24: BEEP 0.3, 24
695 STOP
700 REM === draw sightline ===
710 LET a = g: LET b = h
720 IF f$ = "N" THEN LET a = a - 1
722 IF f$ = "S" THEN LET a = a + 1
724 IF f$ = "W" THEN LET b = b - 1
726 IF f$ = "E" THEN LET b = b + 1
728 IF a < 1 OR a > 8 OR b < 1 OR b > 16 THEN RETURN
730 IF m$(a)(b TO b) = "#" THEN RETURN
732 IF a = r AND b = c THEN GO TO 400
734 PRINT AT a + 2, b + 2; INK 6; "."
736 GO TO 720
760 REM === clear sightline ===
770 LET a = g: LET b = h
772 IF f$ = "N" THEN LET a = a - 1
774 IF f$ = "S" THEN LET a = a + 1
776 IF f$ = "W" THEN LET b = b - 1
778 IF f$ = "E" THEN LET b = b + 1
780 IF a < 1 OR a > 8 OR b < 1 OR b > 16 THEN RETURN
782 IF m$(a)(b TO b) = "#" THEN RETURN
784 IF a = o AND b = p AND j = 0 THEN PRINT AT a + 2, b + 2; INK 6; "*": GO TO 772
786 IF a = w AND b = x THEN PRINT AT a + 2, b + 2; INK 4; "X": GO TO 772
788 PRINT AT a + 2, b + 2; " "
790 GO TO 772
800 REM === draw map ===
810 FOR y = 1 TO 8
820 FOR x = 1 TO 16
830 IF m$(y)(x TO x) = "#" THEN PRINT AT y + 2, x + 2; INK 1; CHR$ 143
840 NEXT x
850 NEXT y
860 RETURN
870 REM === draw HUD ===
880 PRINT AT 0, 0; INK 7; "Lives:"; v; " Score:"; e; " Floor:"; l; "  "
885 IF j = 0 THEN PRINT AT 1, 0; INK 6; "Find * then reach X "
886 IF j = 1 THEN PRINT AT 1, 0; INK 4; "Go to X exit!       "
890 RETURN
900 REM === title screen ===
905 PRINT AT 3, 7; INK 1; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143
910 PRINT AT 4, 7; INK 1; CHR$ 143; " "; CHR$ 143; "  "; CHR$ 143; "  "; CHR$ 143; "  "; CHR$ 143; " "; CHR$ 143
915 PRINT AT 5, 7; INK 1; CHR$ 143; " "; CHR$ 143; "  "; CHR$ 143; "  "; CHR$ 143; "  "; CHR$ 143; " "; CHR$ 143
920 PRINT AT 6, 7; INK 1; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143; CHR$ 143
925 PRINT AT 9, 7; INK 7; BRIGHT 1; "NIGHT PATROL"
930 PRINT AT 13, 6; INK 5; "Sneak past the"
935 PRINT AT 14, 6; INK 5; "guards. Collect *"
940 PRINT AT 15, 6; INK 5; "then reach the X."
945 PRINT AT 18, 5; INK 7; "Press any key"
950 BEEP 0.3, 0: BEEP 0.15, -5
955 PAUSE 0
960 RETURN
1000 REM floor 1
1010 DATA "################"
1020 DATA "#              #"
1030 DATA "#  ## ####  #  #"
1040 DATA "#     #     #  #"
1050 DATA "#  ####  #     #"
1060 DATA "#        #  #  #"
1070 DATA "#   ##      #  #"
1080 DATA "################"
1090 DATA 6,2,3,10,"WWWWWWEEEEEE",2,14,6,15
1100 REM floor 2
1110 DATA "################"
1120 DATA "#   #     #    #"
1130 DATA "#   #  ## # #  #"
1140 DATA "#   #     #    #"
1150 DATA "### #####  #   #"
1160 DATA "#          #   #"
1170 DATA "#   # #     #  #"
1180 DATA "################"
1190 DATA 6,2,3,5,"SSSSNNNN",2,14,6,15
1200 REM floor 3
1210 DATA "################"
1220 DATA "#       #      #"
1230 DATA "# ####  # ###  #"
1240 DATA "#       #      #"
1250 DATA "# ##### # ###  #"
1260 DATA "#              #"
1270 DATA "#  # #   # #   #"
1280 DATA "################"
1290 DATA 6,2,2,3,"EEEEEEEWWWWWWW",2,14,6,15
1300 REM floor 4
1310 DATA "################"
1320 DATA "#  #     #  #  #"
1330 DATA "#  #  #  #     #"
1340 DATA "#     #     #  #"
1350 DATA "#  #  #  #  #  #"
1360 DATA "#  #     #     #"
1370 DATA "#     #     #  #"
1380 DATA "################"
1390 DATA 6,2,2,8,"EEEESSSSWWWWNNNN",2,14,6,15
1400 REM floor 5
1410 DATA "################"
1420 DATA "#    #    #    #"
1430 DATA "# ## # ## # ## #"
1440 DATA "#    #    #    #"
1450 DATA "#### # ## # ####"
1460 DATA "#    #    #    #"
1470 DATA "# ##   ##   ## #"
1480 DATA "################"
1490 DATA 6,2,2,4,"EEEEEEEEEEWWWWWWWWWW",2,14,6,15

Night Patrol title screen with building silhouette

How It Works

Lines 900-960 draw the title screen. Lines 905-920 create a building silhouette using CHR$ 143 blocks — four rows of blue blocks with gaps for windows. “NIGHT PATROL” appears in bright white below. Instructions explain the objective. Two low beeps set the mood, then PAUSE 0 waits for a keypress.

Line 35 creates a border colour array. Each floor gets a different border: blue, cyan, green, yellow, magenta. The border colour changes the feel of each floor — cool blues for early floors, warmer colours as tension increases.

Lines 125-126 show floor intro text. Before the map draws, the screen briefly displays “Floor N” for 40 frames. This gives the player a moment to prepare.

Lines 1300-1490 define floors 4 and 5. Floor 4 has a pillar room — isolated columns create complex sightline shadows. Floor 5 has a grid of rooms connected by narrow corridors.

Lines 650-695 handle victory. “YOU ESCAPED!” in green, final score, “All floors cleared!” — and a five-note ascending fanfare that rises higher than any alarm. The contrast with the alarm sounds makes victory feel earned.

The Building Silhouette

The title screen’s building is made from CHR$ 143 blocks arranged to look like a building with lit windows. The windows are gaps in the block pattern — spaces where the black background shows through. It’s simple but effective: four lines of blocks tell you this is a building at night.

Border Colours as Atmosphere

Each floor’s border colour changes the feel of the entire screen. Blue feels cold and distant. Cyan is clinical. Green feels like night-vision. Yellow raises the tension. Magenta feels urgent. The border wraps the entire display, so even peripheral vision registers the change.

Try This

Different building. Redesign the title screen silhouette. Add a taller building, or a skyline with multiple buildings.

Floor names. Add a string array with floor names: “The Lobby”, “Office Block”, “The Archives”. Print the name alongside the floor number in the intro text.