Skip to content
Game 3

Let the craft fall

First make one craft fall at a steady rate onto flat ground.

In Volley, direction changes but each step stays the same size. Touchdown will eventually change the speed too. First make one craft fall at a steady rate onto flat ground.

Use a 48K ZX Spectrum. Save anything you want to keep before entering NEW; this is a new program. An ordinary A is our provisional craft. We will draw its custom character after the movement rules work.

Add lines 10, 20, 30, 40, 50, 100, 110, 120, 125, 130, 140, 150, 160.

10 BORDER 0: PAPER 0: INK 7: BRIGHT 1: CLS
20 LET y=400: LET r=4: LET v=20
30 FOR c=0 TO 31: PRINT PAPER 4;INK 0;AT 20,c;"=": NEXT c
40 PRINT AT 0,1;"TOUCHDOWN: CONSTANT FALL"
50 PRINT AT r,24;"A"
100 LET ny=y+v
110 IF ny>=1900 THEN LET ny=1900
120 LET nr=INT (ny/100)
125 PRINT AT 1,1;"Position: ";ny;"  "
130 PRINT AT r,24;" ";AT nr,24;"A"
140 LET y=ny: LET r=nr
150 IF y=1900 THEN PRINT AT 2,1;"Contact. RUN to repeat.": STOP
160 PAUSE 2: GO TO 100

Store more detail than the screen shows

y is the vertical position, measured in hundredths of a character row. The starting value 400 means row 4. v=20 is a constant step: one fifth of a row on each update. These are units we chose for this game, not metres or seconds.

LET ny=y+v calculates the next position without changing the current one. INT (ny/100) divides by 100 and rounds down to a whole row. BASIC still performs its ordinary arithmetic; the scale does not turn its variables into a special integer type.

Stored position Position divided by 100 Display row
450 4.5 4
470 4.7 4
490 4.9 4
510 5.1 5

The instrument changes while several successive positions share one row. Keeping only the displayed row would throw away the progress between cells. nr means the next row; r is the row currently drawn.

Contact is a rule

FOR c=0 TO 31 visits all screen columns. The PRINT statement gives each ground cell a green PAPER background and a black = character. The craft occupies one cell above that ground, so its feet reach row 20 when its position reaches 1900, not 2000.

Line 110 uses >=, meaning greater than or equal to. A step that goes beyond 1900 is brought back to 1900. An equality-only test could miss a crossing. The ground drawing does not stop anything by itself.

Line 130 clears the old cell and prints the craft at the resolved new row consecutively. Then line 140 stores the new position. This recalls Volley’s drawing technique: calculate while the previous picture remains visible.

Why can the position instrument change even though the craft stays in the same row?

Show the explanation

Several positions share one displayed row. For example, 450 and 470 both give row 4 after division and INT. The model has changed; the character display cannot show that smaller difference yet.

Run and compare

PAUSE 2 requests a short delay, and GO TO 100 repeats the update. PAUSE can be shortened by key activity; this is not a fixed frame scheduler. At contact the program prints a message and stops deliberately. The 9 STOP statement report is expected. Use RUN for another fall.

Try changing the step from 20 to 40. Predict what happens to the instrument and the time taken to reach ground. Keep the contact clamp: changing a movement step must not let the craft disappear through the floor.

Sources

Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapters 2–4 (variables, decisions and loops), chapter 9 (INT), chapters 15–16 (screen placement and colour), and chapter 18 (movement and PAUSE).