One Line Invaders

In-game screen of One Line Invaders

Program listing on 48K Spectrum

New Version with sound, thanks to Einar Saukas for freeing up a further 45 BASIC character positions, due to some amazing space optimisations.

Einar Saukas also found some further optimisations, leading to this version with multiple attack waves. It's now possible to get scores higher than 12, and to keep playing until you get killed.

Important note on the above listings
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.

Text Listing (Final Version)

1 READ t,b,p,a,s,e,n:
 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

Download the game (original version - no sound)
Download the game (new version - with sound)
Download the game (ultimate edition - with sound and multiple attack waves!)

Is this the first oneliner entry to ever spawn a sequel? Check out One Line Invaders 2: Mothership's Revenge

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 (original version) is to shoot all 12 invaders down before they reach the bottom of the screen, and also to avoid getting shot yourself. For the multple attack waves version, simply try to get a high as score as possible.

Rules of the Game

Back to Sinclair stuff index