123

123


data:text/html,<!DOCTYPE html><html><head><meta name="viewport" content="width=480,user-scalable=no"><style>%23c{background:black;margin:auto;display:block;}</style></head><body><canvas id="c" width="480px" height="640px"></canvas></body><script>g=(e=>[...Array(e).keys()]);const w=480,h=640;var canvas=document.getElementById("c"),c=canvas.getContext("2d"),phtmr=null,started=0,pos={x:w/2,y:h/2},o=[],b=[],sc=0,sco=0;function ci(e,r,s,t){c.beginPath(),c.ellipse(e,r,s,s,.79,0,6.28),c.fill(),c.beginPath(),c.ellipse(e,r,s+5,s+5,.79,0,6.28),t&&c.stroke()}function drlp(){for(ob of(c.clearRect(0,0,w,h),c.lineWidth=2,c.strokeStyle="%23FF4500",o))c.strokeRect(ob.x-5,ob.y-5+sc,10,10);for(bo of(c.lineWidth=1,c.strokeStyle=c.fillStyle="%23FFFFE0",ci(pos.x,pos.y,10,1),c.fillStyle="%233CB371",b))ci(bo.x,bo.y+sc,7);c.font="30px Arial",c.fillText(sco,20,40),window.requestAnimationFrame(drlp)}function die(){clearInterval(phtmr),setTimeout(function(){alert("game over")},250)}function dist(e,r){return x=e.x-r.x,y=e.y-r.y,Math.sqrt(x*x+y*y)}function phl(){for(ob of(pos.x+=vel.x,pos.y+=vel.y,vel.x*=.99,vel.y+=.1,ns=sc+speed+(pos.y<h/2?3-pos.y/(h/6):0),speed<4&&(speed+=.001),~~(sc/300)!=~~(ns/300)&&spwn(~~(9*ra())),sc=ns,pos.y>h&&die(),o))dist(scr(ob,1),pos)<23&&die();b=b.filter(e=>dist(scr(e,1),pos)>23||sco++&&!1)}function spwn(e){for(i of(fl=ra()>.5,chunks_o[e]))o.push(scr_a(i,-1,fl));for(i of chunks_b[e])b.push(scr_a(i,-1,fl))}function strt(){phtmr=setInterval(phl,20),spwn(0)}speed=1,vel={x:0,y:0},chunks_o=[[[.25,0],[.75,0],[.25,3],[.75,3],[.25,6],[.75,6]],[[.5,0],[.5,3],[.5,6]],[[.25,0],[.5,0],[.75,0]],g(8).map(e=>[.1+.1*e,2*e]),g(6).map(e=>[.1+.1*e,0]),g(5).map(e=>[.25,2*e]),g(5).map(e=>[1/6+e/6,0]),g(6).map(e=>[1/3+e/15,0]).concat(g(6).map(e=>[1/3+e/15,18])),g(16).map(e=>[.06+e/17,~~e%4*4])],chunks_b=[[[.5,3]],[[.25,3],[.75,3]],[],[],[[.8,0]],[[.75,5]],g(5).map(e=>[1/6+e/6,2]),g(6).map(e=>[1/3+e/15,8]),[[.5,6]]],ra=Math.random,scr_a=((e,r,s)=>({x:s?e[0]*w:w-e[0]*w,y:10*-e[1]+r*sc})),scr=((e,r)=>({x:e.x,y:e.y+r*sc})),canvas.addEventListener("mousedown",function(e){vel.x=(e.clientX-canvas.getBoundingClientRect().left)/w*10-5,vel.y=-5*pos.y/h,!started&&(started=1,strt())}),drlp();</script></html>

Report Page