It was suppose to be a game called "Circles vs. Squares" where a circle shoots around squares enemies. Well, I didn't find the time (and space) to add the squares :) so it is apparently became just a…
d=document;M=Math;R=M.round;W=800;H=400;e=d.body.children.c;c=e.getContext("2d");e.width=W;e.height=H;c.font="16px sans";x=W/2;y=H/2;vy=vx=0;ra=10;sa=1;cl=15;ps=2;sh=4;shoots=[];my=mx=0;function inside(a,b){return!(a<0||b<0||a>W||b>H)}d.onkeydown=function(a){n=a.keyCode-38;if(n>-2&&n<3){vx=n%2?n*ps:vx;vy=!(n%2)?(n-1)*ps:vy}};d.onkeyup=function(a){if(a.keyCode%2)vx=0;else vy=0};
d.onmousemove=function(a){if(a.layerX||a.layerX==0){mx=a.layerX;my=a.layerY}else if(a.offsetX||a.offsetX==0){mx=a.offsetX;my=a.offsetY}};i=0;
setInterval(function(){c.clearRect(0,0,W,H);c.beginPath();if(inside(x+vx,y+vy)){x+=vx;y+=vy}c.arc(x,y,ra,0,M.PI*2,true);c.fill();c.moveTo(x,y);pita=M.sqrt(M.pow(mx-x,2)+M.pow(my-y,2));dx=(mx-x)/pita;dy=(my-y)/pita;c.lineTo(x+cl*dx,y+cl*dy);c.stroke();i++%5||shoots.push({sx:x+cl*dx,sy:y+cl*dy,sdx:dx,sdy:dy});for(te=shoots.length;te--;){t=shoots.shift();t.sx+=t.sdx*sh;t.sy+=t.sdy*sh;c.beginPath();c.arc(t.sx,t.sy,sa,0,M.PI*2,true);c.fill();c.closePath();inside(t.sx,t.sy)&&shoots.push(t)}},30);
ZD1kb2N1bWVudDtNPU1hdGg7Uj1NLnJvdW5kO1c9ODAwO0g9NDAwO2U9ZC5ib2R5LmNoaWxkcmVuLmM7Yz1lLmdldENvbnRleHQoIjJkIik7ZS53aWR0aD1XO2UuaGVpZ2h0PUg7Yy5mb250PSIxNnB4IHNhbnMiO3g9Vy8yO3k9SC8yO3Z5PXZ4PTA7cmE9MTA7c2E9MTtjbD0xNTtwcz0yO3NoPTQ7c2hvb3RzPVtdO215PW14PTA7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NpZGUodC5zeCx0LnN5KSYmc2hvb3RzLnB1c2godCl9fSwzMCk7
// js1k 2010 entry by Ilan Bar-Magen
d=document;
M=Math;
R=M.round;
W=800;
H=400;
// get the canvas
e=d.body.children.c;
c=e.getContext('2d');
e.width=W;e.height=H;
c.font = '16px sans';
x=W/2;y=H/2;vx=0;vy=0;
ra = 10; //Radius of player circle
sa = 1; //Radius of player circle
cl= 15; //Cannon length
ps = 2; //player speed
sh = 4; //shooting speed
shoots = new Array();
mx=0;my=0;
function inside(x,y) {return !(x<0||y<0||x>W||y>H);}
//move circle
d.onkeydown = function(ev){n=ev.keyCode-38; if(n>-2&&n<3){vx=n%2?n*ps:vx;vy=!(n%2)?(n-1)*ps:vy;}}
d.onkeyup = function(ev){if(ev.keyCode%2) vx=0; else vy=0;}
d.onmousemove = function(ev) {
if (ev.layerX || ev.layerX == 0) { // Firefox
mx = ev.layerX;
my = ev.layerY;
} else if (ev.offsetX || ev.offsetX == 0) { // Opera
mx = ev.offsetX;
my = ev.offsetY;
}
//mx = window.event.clientX;
//my = window.event.clientY;
}
i=0;
setInterval(function(){
c.clearRect(0,0,W,H);
c.beginPath();
//draw circle:
if(inside(x+vx,y+vy)){x = x+vx;y = y+vy;} //move circle
c.arc(x,y, ra, 0, M.PI*2, true);
c.fill();
c.moveTo(x,y);
//draw cannon
pita = M.sqrt(M.pow(mx-x,2)+M.pow(my-y,2));
dx = (mx-x)/pita;
dy = (my-y)/pita;
c.lineTo(x+cl*dx,y+cl*dy);
c.stroke();
if (!(i++%5)){shoots.push({sx:x+cl*dx,sy:y+cl*dy,sdx:dx,sdy:dy});} //Create new shooting
// draw shootings
te = shoots.length;
while(te--){
t = shoots.shift();
t.sx += t.sdx*sh;
t.sy += t.sdy*sh;
c.beginPath();
c.arc(t.sx,t.sy, sa, 0, M.PI*2, true);
c.fill();
c.closePath();
if(inside(t.sx,t.sy)){shoots.push(t)};
}
}, 30);