One Line Invaders

In-game screen of One Line Invaders.

Program Listing on 48K Spectrum.

Text Listing

1 READ t,b,p,a,s,e,n:
 BORDER 0:
 POKE 23693,7:
 CLS :
 DIM i$(3,9):
 FOR g=1 TO 3:
 LET i$(g)=" # # # #":
 NEXT g:
 FOR y=0 TO 13:
 LET e=24-e:
 FOR x=24-e TO e STEP e/12-1:
 FOR i=1 TO 3:
 PRINT AT y-1+2*i,x,AT y+2*i,x;i$(i):
 NEXT i:
 LET z=(b>y)*(b<y+7)*(a>x)*(a<x+9):
 LET k=1+z*(b-y-2)/2:
 LET l=1+z*(a-x):
 LET h=i$(k,l)>" ":
 PRINT AT g-1,x+3;"   ";AT g,x+4;"|";AT 21,0;s,,AT b+1,a;" ";AT b,a;"| "(1+h+(b=0));AT 20,p-1;" ^ ":
 IF x+3-p+g/20 THEN LET i$(k,l)="":
 LET s=s+h:
 LET p=p-(IN 64510<n)*(p>1)+(IN 57342<n)*(p<30):
 LET b=(1-h)*(b+19*(IN 32766<n)*(b=0)-(b>0)):
 LET a=a+(p-a)*(b=19):
 LET g=1+g+(g=21)*(y+4-g):
 BEEP .01,y+t:
 LET t=1-t:
 NEXT x:
 NEXT y:
 POKE 23620,32-30*(s/12=INT (s/12)):
 DATA 0,0,16,p,0,0,191

About the game

Written in a single line of ZX BASIC, the game consists of a small fleet of 12 space invaders. The goal of the game is to shoot all 12 invaders down before they reach the bottom of the screen, and also to avoid getting shot yourself. In this multiple attack waves version, successive waves of invaders will appear. So you can try to get a score as high as possible.

Rules of the Game

Important note on the program listing
Due to limited space available in the above program listings, the method of keyboard reading is very simple, and does not mask off the 'ear' bit. Therefore the value of 'n' used to compare against the IN command (found at the very end of the program listing) may have to be changed to either 191 or 255 depending on the issue of the ZX spectrum in use, the internal state of a snapshot file, or the emulator and settings in use. Otherwise the keyboard may not respond.
In this game compilation, the problem is avoided by having two versions of the program in the tape file. The correct version for your system automatically loads depending on a keyboard reading check performed by the menu program.

Back to documentation index