Let gravity change the speed
Gravity will change that amount before we use it.
Continue with Let the craft fall. The craft currently adds the same amount to its position every time. Gravity will change that amount before we use it.
Add lines 95, 96. Replace lines 20, 40, 125, 160.
10 BORDER 0: PAPER 0: INK 7: BRIGHT 1: CLS
20 LET y=400: LET r=4: LET v=0
30 FOR c=0 TO 31: PRINT PAPER 4;INK 0;AT 20,c;"=": NEXT c
40 PRINT AT 0,1;"TOUCHDOWN: GRAVITY"
50 PRINT AT r,24;"A"
95 LET v=v+2
96 IF v>60 THEN LET v=60
100 LET ny=y+v
110 IF ny>=1900 THEN LET ny=1900
120 LET nr=INT (ny/100)
125 PRINT AT 1,1;"Pos: ";ny;" ";AT 1,16;"Speed: ";v;" "
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 95
Speed changes first
v is now the vertical velocity: the signed change in position for one update. It starts at zero. Line 95 adds 2 to it; line 100 then adds that new velocity to the position. In this model, increasing screen rows mean moving downwards.
Starting at position 400, the first updates are:
| Update | Velocity after gravity | New position |
|---|---|---|
| 1 | 2 | 402 |
| 2 | 4 | 406 |
| 3 | 6 | 412 |
| 4 | 8 | 420 |
The distance covered grows even though gravity’s increment stays at 2. A force in a more detailed simulation would depend on mass and time; here we are choosing a small game model whose rule we can follow directly.
The instrument shows both position and velocity. A row change is no longer evidence of a constant step. Watch the number as well as the character.
What would happen if we added 2 to the position but left the velocity unchanged?
Show the explanation
That would add the same distance each time. It would produce another constant-speed fall, rather than the growing steps in the table. Acceleration changes velocity; velocity changes position.
Keep the useful limits
Line 96 caps downward velocity at 60. This is a design limit, not a claim about a spacecraft’s real terminal velocity. It prevents the later game becoming an unreadable plunge. The flight loop now returns to 95, so gravity is applied on every update.
The existing contact clamp remains. It must work even when a step crosses the surface. For example, a proposed move from 1880 by 60 gives 1940; line 110 resolves that to 1900 before drawing. We do not need to land on an exact value by chance.
Run it several times without pressing a key. The starting situation repeats, the speed grows to 60, and contact still ends the program. Compare it with the constant-speed version rather than adjusting the gravity increment and delay together: changing one rule gives you an interpretable experiment.
If the craft continues falling at one speed, check that line 160 returns to 95 and that line 95 changes v, not y.
Sources
Steven Vickers, edited by Robin Bradbeer, ZX Spectrum BASIC Programming, second edition (Sinclair Research, 1983), chapters 7 and 9 (expressions and INT), and chapter 18 (movement).