Skip to content
Game 4 Unit 6 of 6 1 hr learning time

Title and Instructions

A title, the rules on four lines, and PAUSE 0 to begin — the framing that turns a reaction loop into a game. Reflex, complete.

100% of Reflex

The mechanic is finished, but the game still starts cold — no name, no rules, straight into "Get ready..." A reaction test is the least forgiving place to leave the player guessing: the first flash is the test, and there is no second chance to read the rules once it fires. One screen of framing fixes that.

  10 BORDER 0: PAPER 0: INK 7: CLS
  20 RANDOMIZE
  30 PRINT AT 3, 9; BRIGHT 1; "*** REFLEX ***"
  40 PRINT
  50 PRINT "Wait for the screen to"
  60 PRINT "flash red, then press"
  70 PRINT "any key as fast as you can."
  80 PRINT
  90 PAUSE 0
 100 CLS
 110 PRINT "Get ready..."
 120 PRINT
 130 PLOT 26, 90: DRAW 204, 0: DRAW 0, -6: DRAW -204, 0: DRAW 0, 6
 140 PLOT 28, 88
 150 DRAW 200, 0
 155 LET e = INT (RND * 140) + 88
 160 FOR x = 28 TO e
 170 PLOT x, 87
 180 BEEP 0.01, 10
 190 NEXT x
 210 PAPER 2: BORDER 2: CLS
 220 BEEP 0.05, 30
 230 LET t = 0
 240 IF INKEY$ <> "" THEN GO TO 270
 250 LET t = t + 1
 260 GO TO 240
 270 PAPER 0: BORDER 0: CLS
 280 PRINT AT 3, 9; BRIGHT 1; "*** REFLEX ***"
 290 PRINT
 300 PRINT "Your time: "; t
 310 PRINT
 320 IF t < 5 THEN INK 4: PRINT "Lightning!": BEEP 0.1, 20
 330 IF t >= 5 AND t < 15 THEN INK 5: PRINT "Quick!": BEEP 0.1, 15
 340 IF t >= 15 AND t < 30 THEN INK 6: PRINT "OK": BEEP 0.1, 10
 350 IF t >= 30 THEN INK 2: PRINT "Slow...": BEEP 0.1, 0
Black ZX Spectrum screen: the bright title REFLEX above three lines of instructions telling the player to wait for the red flash and press fast
The title screen: the name, the rules, and PAUSE 0 holding until you are ready.

The framing screen

Lines 30–80 are all PRINT you already know from Meet BASIC. Line 30 centres the title with PRINT AT 3, 9 and makes it BRIGHT 1; lines 50–70 spell out the rules — "wait for the screen to flash red, then press any key as fast as you can" — and line 90's PAUSE 0 holds the screen until the player presses a key. PAUSE 0 means wait forever (zero is the special case), so the player starts when they are ready, not on a timer. Lines 280–290 reprint the title on the result screen, so the verdict arrives under the game's name instead of on a bare black field.

The rules go before PAUSE 0, while the player is relaxed and reading. By the time "Get ready..." appears, the instructions are already in their head and their finger is over the key.

Black ZX Spectrum screen: the bright title REFLEX, the line Your time: 5, and Quick! in cyan
The finished game delivers its verdict under its own name.

What you built

Reflex began with one genuinely new command — INKEY$, the keyboard read that does not stop the program — and grew a whole game around it. A loop turned that read into a measured time; a chain of IFs turned the time into a verdict. Then the parts you already had went to work: PLOT and DRAW built a bar that telegraphs the wait, PAPER flashed the signal, BEEP marked every beat, and a title screen wrapped the lot.

That is the shape of every real-time game you will write from here: poll the input, react, respond — fast enough that the player feels the machine answering them, live.

Next: Dice Roller — roll dice with FOR/NEXT, tally the results, and watch patterns emerge from randomness.