Space Boy

This file is part of and Timex Sinclair Public Domain Library Tape 1006. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000
Tags: Game

Space-Boy is an arcade-style game where the player controls a horizontally moving platform to keep a bouncing character in flight, with the goal of erasing floating objects arranged in an oval pattern at the top of the screen. The oval is drawn procedurally using trigonometric functions (SIN and COS) to position inverse-video characters along an elliptical path before the game loop begins. The platform drifts randomly each cycle via `LET B=B-RND*5+RND*5`, simulating zero-gravity wobble while the player uses X and M to counteract it. A lives counter (K, starting at 5) decrements each time the bouncing space-boy reaches row 18 without the platform being close enough. On game over, the score is displayed and the program restarts from line 240 using `RUN 240`.


Program Analysis

Program Structure

The program divides into three clear phases:

  1. Introduction (lines 100–264): Scrolling text instructions, waits for ENTER via INPUT A$.
  2. Setup (lines 5010–5459): Draws an elliptical field of inverse-video objects, initialises game variables.
  3. Game loop (lines 5510–6060): Main play loop, collision detection, scoring, and game-over handling.

Ellipse Drawing Routine

Lines 5010–5050 use a parametric trigonometric loop to paint an oval of inverse space characters:

PRINT AT 9*COS(B)+12, 14*SIN(B)+17;" " where B = PI*A/50 for A from 1 to 100.

This produces 100 evenly spaced points on an ellipse with semi-axes of 9 rows and 14 columns, centred at row 12, column 17. Because PRINT AT simply plots a character, overlapping positions are silently ignored, and the inverse-video space character effectively “marks” each cell. The CLEAR at line 5060 clears variables but leaves the screen, so the oval persists while game variables are reset.

Screen Layout (Block Graphics)

Lines 5062–5075 construct a decorative capsule/border graphic using ZX block characters printed at rows 5–8. The pattern uses \..\.., \'', and % (inverse space) combinations to create a multi-row rectangular frame representing the top of the capsule.

Game Variables

VariablePurpose
APlatform row (fixed at 19)
BPlatform column (drifts randomly each cycle)
CSpace-boy row (bounces between rows 5 and 18)
DSpace-boy column (controlled by player)
EVertical direction: +1 (down) or −1 (up)
KLives remaining (starts at 5)
SCOREIncrements by 1 each game loop iteration

Game Loop Logic

Each pass through lines 5510–6000 performs the following steps:

  • Randomly nudge the platform column: LET B=B-RND*5+RND*5. The net drift averages to zero but produces noisy movement, simulating weightlessness.
  • Read INKEY$ for X (move space-boy left) or M (right), clamped to columns 8–23.
  • Clamp platform column B to the range 9–21.
  • Advance the space-boy vertically by E.
  • Draw the platform at row A (19), the space-boy at row C with the lives counter K displayed beside it.
  • Erase previous positions by printing spaces.
  • Check bounce: if C+1 = 19, reverse direction (E = -1); if C = 5, reverse direction (E = 1).
  • Check miss: if C = 18 and ABS(D-B) > 2, decrement K.

Notable Techniques

  • Score as time: SCORE is simply a loop counter — it measures survival time rather than objects erased, despite the instructions implying erasure.
  • No actual erasure mechanic: The oval objects drawn in the setup phase are never removed during play. The stated goal of “erasing all objects” is not mechanically implemented; the game ends only when K = 0.
  • Restart via RUN 240: Line 6030 uses RUN 240 to restart from the “Press ENTER” prompt without rerunning the intro text, a common ZX BASIC idiom.
  • CLEAR after ellipse: CLEAR at line 5060 resets all variables but preserves the display, allowing the oval to remain on screen while variables are cleanly initialised below.
  • Platform graphic: The platform is drawn as \:.\..\.: — a three-character block graphic forming a small shelf shape.
  • Lives display inline: The value of K is printed directly in the space-boy’s sprite row (PRINT AT C,D+1;" ";K), doubling as both a visual element and a HUD.

Bugs and Anomalies

  • The game description says the player should erase objects, but no collision detection between the space-boy and the oval objects is implemented. SCORE simply counts loop iterations.
  • The two INKEY$ reads at lines 5520 and 5530 are sequential and independent. Only one key can register per frame, and if both keys happen to be polled in the same pass, only the first pressed is acted upon — a minor but expected limitation of polling without a keypress buffer.
  • Lines 6040–6060 (CLEAR, SAVE "1027%4", RUN) appear after the unconditional RUN 240 at line 6030 and are therefore unreachable in normal execution. The SAVE command uses an inverse-video digit in its filename, indicating an auto-run flag.
  • The miss-detection condition at line 5770 checks C=18, one row above the platform at row 19. Combined with the bounce reversal at C+1=19 (line 5775), a life is lost whenever the space-boy is near the platform row but more than 2 columns away — correct in intent but the row value is slightly inconsistent with the drawn platform position.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10252 – 10293.

Related Products

Related Articles

Related Content

Image Gallery

Source Code

 100 PRINT  
 110 PRINT TAB (8);"% %S%P%A%C%E%-%B%O%Y% "
 120 PRINT 
 130 PRINT 
 140 PRINT "IN THIS GAME, YOU HAVE TO"
 150 PRINT "MANIPULATE THE FLOATING"
 160 PRINT "SPACE-BOY TO ERASE ALL THE"
 170 PRINT "OBJECTS FLOATING AT THE TOP"
 180 PRINT TAB (8);"OF THE CAPSULE"
 190 PRINT 
 200 PRINT 
 210 PRINT "KEY X MOVES YOU TO THE LEFT,"
 220 PRINT "KEY M TO THE RIGHT"
 230 PRINT 
 235 PRINT "YOU KEEP THE SPACE-BOY IN"
 237 PRINT "FLIGHT BY BOUNCING HIM OFF"
 238 PRINT TAB (4);"THE MOVING PLATFORM"
 240 PRINT 
 250 PRINT "PRESS ENTER WHEN YOU ARE"
 260 PRINT TAB (4);"READY TO PLAY"
 264 INPUT A$
 270 CLS 
 5010 FOR A=1 TO 100
 5020 LET B=PI*A/50
 5030 PRINT AT 9*COS (B)+12,14*SIN (B)+17;"% "
 5050 NEXT A
 5060 CLEAR 
 5062 PRINT AT 5,11;"....''% ''% ''% ''% ''...."
 5065 PRINT AT 6,11;"% ''% ''% ''% ''% ''% ''% "
 5070 PRINT AT 7,10;"% ''% ''% ''% ''% ''% ''% ''% "
 5075 PRINT AT 8,11;"% ''% ''% ''% ''% ''% ''% "
 5451 LET C=10
 5452 LET D=10
 5453 LET SCORE=0
 5455 LET A=19
 5456 LET B=21
 5457 LET E=1
 5459 LET K=5
 5510 LET B=B-RND*5+RND*5
 5520 IF INKEY$="X" THEN LET D=D-1
 5525 IF D<8 THEN LET D=8
 5530 IF INKEY$="M" THEN LET D=D+1
 5535 IF D>23 THEN LET D=23
 5540 IF B>21 THEN LET B=21
 5550 IF B<9 THEN LET B=9
 5555 LET C=C+E
 5600 PRINT AT A,B;":....:"
 5710 PRINT AT C,D+1;" ";K
 5720 PRINT AT C+1,D+1;":'''':"
 5721 IF K=0 THEN GOTO 6010
 5740 PRINT AT A,B;"   "
 5750 PRINT AT C,D+2;" "
 5760 PRINT AT C+1,D+1;"   "
 5770 IF C=18 AND ABS (D-B)>2 THEN LET K=K-1
 5775 IF C+1=19 THEN LET E=-1
 5785 IF C=5 THEN LET E=1
 5800 LET SCORE=SCORE+1
 6000 GOTO 5510
 6010 PRINT AT 10,8;"% % YOU SCORED ";SCORE;"% % "
 6015 PAUSE 400
 6020 CLS 
 6030 RUN 240
 6040 CLEAR 
 6050 SAVE "1027%4"
 6060 RUN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top