document.getElementById('sc').innerText=score; goalS(); bx=180;by=450;bvx=0;bvy=0;} if(by>700||bx<-50||bx>410){bx=180;by=450;bvx=0;bvy=0;}} function draw(){x.clearRect(0,0,360,640); x.fillStyle='#2ecc71'; x.fillRect(0,0,360,640); x.strokeStyle='white'; x.lineWidth=2; x.strokeRect(20,20,320,600); x.fillStyle='#fff'; x.fillRect(gx-50,50,100,10); x.fillRect(gx-50,50,6,60); x.fillRect(gx+44,50,6,60); x.save(); x.translate(bx,by); x.rotate(Date.now()/200); x.fillStyle='white'; x.beginPath(); x.arc(0,0,16,0,6.28); x.fill(); x.strokeStyle='black'; x.stroke(); x.fillStyle='black'; x.beginPath(); x.arc(0,0,6,0,6.28); x.fill(); x.restore(); drawCapy(130,470); requestAnimationFrame(()=>{upd(); draw();});} document.getElementById('btn').addEventListener('touchstart',e=>{e.preventDefault(); kick();}); document.getElementById('btn').addEventListener('click',kick); draw();