A game. The objective of each level is to get the water level to the top of the screen. Water is displaced by green beach balls, which are created and expanded by pressing and holding the mouse button…
a="v a,b,c,d,e,f,g,h,i,j,k,l,m=3,n=docume.body,o=n.children.c,pgetCo2d\"qwidWid,sheightHeight-6,w=q*s,z,A=Ma,B=A.random,D;n.style.mginup=%0};down=C4!m)l--eX,y:eY,r:%1,t:1,u:v:0}else m=2};setIerval(4!m&&z>wbm=1;D100*(c+lm4m<3)alert((m-1?\"GAME OVER\"7LEVEL DONE\")+\"\\nSCORE: \"+Dm&2)c=Dz=%ml=8c+5;a=[]2*c;d89+(qy:9+(sr:9,t:ucos(i=B()*2vsin(iJpfill \"#006q,s) \"blues-z/q,q,sz=w/2k;d8)Ja[d]4d<br2||%0}zr*r;xu;yv)u=-u@v=-vee<k;e8j=a[e]@d!=ef=x-Fx;g=y-Fy;i=f*f+g*g;h=r+Fr@i<h*hi=i?2*(u*f+v*g)/i:0;u-=i*f;v-=i*g@b&&d==0b!Fta.shift(k--}}e=k}}}beginPa(c(x,y,r,2,1) t?\"#0A0\"7red\"(fo=\"32px ial\"TL7+c+\" B7+l,550},33";for(b in c="Jwi(Fj.@;8++7:\"4%b=),ntar:2*A.dd<C.pagext(\"=o.)}+=0,=inner);th-18)*B(onmouse\"Rect(0,A.PI*;for(y<r||y>s-r) Style=;x<r||x>q-r){=0;)k=a.unshift({x:function(;fillif(".split(""))a=a.replace(RegExp(c[b][0],"g"),c[b].slice(1));eval(a)
YT0idh0gYSxiLGMsZCxlLGYsZyxoLGksaixrLGwsbT0zLG49ZG9jdW1lHi5ib2R5LG89bi5jaGlsZHJlbi5jLHAYZ2V0Q28eGTJkXCIfcRh3aWQSFFdpZBIscxhoZWlnaHQUSGVpZ2h0LTYsdz1xKnMseixBPU1hEixCPUEucmFuZG9tLEQ7bi5zdHlsZS5tHWdpbgYQdXA9BAclMH07EGRvd249BEM0IW0pAmwtLQUaZVgseToaZVkscjolMSx0OjEsdToVdjowfRNlbHNlIG09Mn07c2V0SR5l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MSkpO2V2YWwoYSk=
var balls ;
var creating ; // are we in creation mode?
var level ;
var i, j ; // loop variables
var dx,dy ; // difference in x,y position
var dist, theta ;
var ball2 ;
var ballCount ;
var ballsRemaining ;
var gamePhase = 3; // 0: in game; 1: going to next level; 2: game over
var body = document.body;
var canvas = body['children']['c'];
var ctx = canvas.getContext( '2d' );
var width = canvas.width = innerWidth;
var height = canvas.height = innerHeight-6 ;
var totalArea = width*height ;
var area ;
var math = Math ;
var rnd = math.random ;
var score ;
body.style.margin = 0 ;
onmouseup = function(){creating=0;};
onmousedown = function(event){
if(!gamePhase)
if(ballsRemaining--){
// 'creating' is set to 1 in the following statement
ballCount = balls.unshift({'x':event.pageX,'y':event.pageY,'r':creating=1,'t':1,'u':0,'v':0});
}else{
gamePhase=2;
}
};
setInterval(
function ()
{
if (!gamePhase && area > totalArea){
creating=0; gamePhase = 1; score += 100*(level+ballsRemaining) ;
}
if (gamePhase){
if (gamePhase<3){
alert ((gamePhase-1?'GAME OVER':'LEVEL DONE')+'\nSCORE: '+score) ;
}
if (gamePhase&2){
level = score = 0 ;
}
area = creating = gamePhase = 0 ;
ballsRemaining = ++level + 5 ;
balls = [] ;
for (i=0; i < 2*level; i++){
ballCount = balls.unshift({'x':9+(width-18)*rnd(),'y':9+(height-18)*rnd(),'r':9,'t':0,
'u':2*math.cos(theta=rnd()*math.PI*2),'v':2*math.sin(theta)}) ;
}
}
with (ctx){
fillStyle = "#006" ;
fillRect(0,0,width, height);
fillStyle = "blue" ;
fillRect(0,height-area/width, width, height) ;
area = totalArea/2 ;
for (i=0; i<ballCount; i++){
with(balls[i]){
if (i<creating){ // creating && i==0
r += 2 ;
if (x < r || x > width-r || y < r || y > height-r){
creating=0 ;
}
}
area += math.PI*r*r ;
x += u ;
y += v ;
if (x < r || x > width-r){
u = -u ;
}
if (y < r || y > height-r){
v = -v ;
}
for (j=0; j<ballCount; j++){
ball2 = balls[j] ;
if (i!=j){
dx = x - ball2['x'];
dy = y - ball2['y'] ;
theta = dx*dx+dy*dy ; // dot product
dist = r + ball2['r'];
if (theta < dist*dist){
// balls have touched, compute a bounce
theta = theta ? 2*(u*dx + v*dy)/theta:0 ;
u -= theta*dx ;
v -= theta*dy ;
if (creating && i==0){
creating = 0 ;
if(!ball2['t']){
balls.shift() ;
ballCount-- ;
}
}
j = ballCount ; // break
}
}
}
beginPath();
arc(x,y,r,0,math.PI*2,1);
fillStyle = t ? '#0A0' : 'red';
fill();
}
}
font = '32px arial' ;
fillText ('L:'+level+' B:'+ballsRemaining, 50,50) ;
}
}
, 33);