I have participated again in a small challenge where the goal was to create an invaders game clone under 1 kilobyte.
Space Invaders: 1K Challenge was organised on the forums of the Love2D game engine, and it took place in December, 2017.
Features & controls
- The entire game is only 756 bytes long
- Animated enemies made of mirrored chars
- Bullets and collision resolution
- Enemies, the player ship and bullets
- The game restarts on winning or losing
- Score and lives counter at the top bar
- Use A or D to move, shooting is automatic
Download links
I only provide the Love2D version of this minigame. In order to play it, you will need to install Love2D on your computer.
Source code
This is the entire source code for the game, including graphics an animations.
L=love;G=L.graphics;P=G.print;D=L.keyboard.isDown;M=L.mouse;H=math;o=0;n=3;a=255;b=10; function S()k=0;l=0;p=65;q="Rgg00"t={}for e=1,5 do t[e]={}for f=1,9 do t[e][f]=q:sub (e,e)end end;u=20;v=b;w=1;z=.1 end;function Y(c,x,y)P(c,x,y)P(c,x+3,y,0,-1,1)end;G. setDefaultFilter("nearest")G.setNewFont(8)S()function love.draw()G.push()G.scale(6)if n>0 then d=0;for e=5,1,-1 do G.setColor(e%5*a,e%2*a,e%3*a)for f=1,9 do x=u+f*b-5;y=v+e *b-5;c=t[e][f]if(x+y)%9==0 then r="Rg0"s="PqQ"g=r:find(c)h=s:find(c)c=g and s:sub(g,g) or(h and r:sub(h,h)or c)end;c=c=="*"and" "or c;if c~=" "then d=1;if k>x-3 and k<x+6 and l>y and l<y+9 then c="*"z=z-.002;o=o+b;k=p;l=90 end end;t[e][f]=c;Y(c,x,y)end;if d==1 and y>82 then n=n-1;S()end end;u=u+w;if u%40==0 then w=w*-1;v=v+3 end;if d==0 then o=o+ b^3;S()end;if l<0 then k=p;l=90 end;P("'",k,l)l=l-3;p=M.isDown(1)and(M.getX()<400 and p-2 or p+2)or p;p=D("a")and p-2 or(D("d")and p+2 or p)p=H.max(5,H.min(125,p))end;Y("k", p,90)P(o,3,3)P(n,122,3)G.rectangle("line",1,1,131,98)G.pop()L.timer.sleep(z)end