JS1K submission

Name:
Sky Battle
Description:
Multiplayer flying arcade for JS1k contest.
Features:
  • 9 hits to kill
  • barrel overheating
  • world is a cylinder
  • gravity simulation
Controls:
"j","k","l" for 1 player. arrow keys for 2 player.
Let's the battle bigins!
Comments coming soon.
f=[{B:1},{}],
K=[H=64],
c.height=c.width=T=576,
a.scale(B=9,B),
setInterval(function(){o=T++%2;
with(a){
	G=function(a,b,c,d,e,f){
		e?rect(b,c,d,e):arc(b,c,d,0,7,0),
		fill(fillStyle='#'+'66c9cfff00'.substr(a,3)),
		beginPath(f||stroke())
	},
	lineWidth=l=.1,
	G(3,0,0,H,H);
	for(i=2;i--;)with(p=f[i]){
		save(Z=-1),
		T-B<H
		?L=G(o+6,x,y,2)
		:(	B&&(p.L=p.S=p.y=9,p.P|=p.B=p.h=0,p.x=H-i*H,p.z=i?l:3,p.v=.3),
			translate(x,y),rotate(z),i||scale(1,Z),
			G(4,1,-.5,.5),G(n=T-h<3?7:i,Z,Z,Z,1),G(n,-2,-.5,4,1),G(n,Z,0,2,.5),G(n,2.3,o,l,-2*o)
		),		
		restore(K[j=r+r*i]&&(z-=l),
				K[j+1]&!B&S>0&&(S--,f[Z=x+y]={x:x,y:y,z:z,v:3}),
				K[j+2]&&(z+=l),
				T%6||S>9||S++);
		
		for(k in f)with(m=f[k])
			(t=k<2)&&m.B||(
				x=(x+v*Math.cos(z)+72)%72,
				y+=v*Math.sin(z)+l,
				i|t||G(6,x,y,.2)
			),
			v=Z^k?v:1,
			i==k|B|p.B||
				((q=p.x-x)*q+(Q=p.y-y)*Q<(t?9:3)&&(t?p.B=T:--L?h=T:(p.B=T,P++))||y<0|y>H)
				&&(t?B=T:delete f[k]);
			for(k=9;k--;m=i?k+2:61-k,k<S&&G(6,m,5,1),G(k<L?n:3,m,1,1,2))
				t=k>3?14:r,i||G(5,(T/2+t)%99-k*4,t+k%2*4,8,0,1);
			strokeText(P,i?9:55,60)
	}
}},r=37),
Z=document,Z.onkeydown=Z.onkeyup=function(a){K[a.keyCode]=a.type[5]&&1}