"PatrePong" By ZippySqrl (https://pastebin.com/u/ZippySqrl) URL: https://pastebin.com/ibXc9Wkw Created on: Monday 19th of June 2017 04:30:44 PM CDT Retrieved on: Saturday 31 of October 2020 04:26:10 PM UTC function getMousePos(e,a){var l=PA.getBoundingClientRect();return{x:a.clientX-l.left,y:a.clientY-l.top-PA.height/2}}function gRA(e,a){return Math.random()*(a-e)+e}var css="#PPbckgnd{position:fixed;left:0px;top:0px;width:100%;height:100%;background-color:rgba(127,127,127,0.4);z-index: 9999;}#PatrePong{margin: 0 auto;width:500px;height:500px;position:fixed;top:calc(50% - 250px);left:calc(50% - 250px);border-radius:9px;background-color:rgb(249,104,85);}",style=document.createElement("style");style.type="text/css",style.styleSheet?style.styleSheet.cssText=css:style.appendChild(document.createTextNode(css)),head=document.head||document.getElementsByTagName("head")[0],head.appendChild(style);var PPB=document.createElement("div");PPB.id="PPbckgnd";var PA=document.createElement("canvas");PA.id="PatrePong",PA.setAttribute("width","500"),PA.setAttribute("height","500"),PPB.appendChild(PA),document.body.appendChild(PPB);var GA={canvas:PA,SG:function(){this.canvas.width=500,this.canvas.height=500,this.context=this.canvas.getContext("2d"),this.frameNo=0,this.B.x=0,this.B.y=0,this.P.y=0,this.Q.y=0,null===this.int==!1&&clearInterval(this.int),this.int=setInterval(this.update,20),this.B.dir=Math.random()*Math.PI,this.B.S=2},restart:function(){this.SG()},B:{x:0,y:0,r:10,S:2,dir:0,v:{x:0,y:0}},P:{x:-200,y:0,width:10,height:50,S:4,score:0},Q:{x:200,y:0,width:10,height:50,S:4,score:0},ctrl:{up:!1,down:!1,mouse:{pos:{x:0,y:0}}},update:function(){G=GA,C=G.context,G.frameNo+=1,MD=G.P.y-G.ctrl.mouse.pos.y,MD<-G.P.height/3?G.P.y=Math.min(PA.height/2-G.P.height/2,G.P.y+G.P.S):MD>G.P.height/3&&(G.P.y=Math.max(-PA.height/2+G.P.height/2,G.P.y-G.P.S)),BD=G.Q.y-G.B.y,BD<-G.Q.height/3?G.Q.y=Math.min(PA.height/2-G.Q.height/2,G.Q.y+G.Q.S):BD>G.Q.height/3&&(G.Q.y=Math.max(-PA.height/2+G.P.height/2,G.Q.y-G.Q.S)),G.B.x+=Math.sin(G.B.dir)*G.B.S,G.B.y+=Math.cos(G.B.dir)*G.B.S,G.B.y<-PA.height/2+G.B.r&&(G.B.y=-PA.height/2+G.B.r+(G.B.y-(-PA.height/2+G.B.r)),G.B.dir=-1*(G.B.dir+Math.PI/2)-Math.PI/2),G.B.y>PA.height/2-G.B.r&&(G.B.y=PA.height/2-G.B.r+(G.B.y-(PA.height/2-G.B.r)),G.B.dir=-1*(G.B.dir+Math.PI/2)-Math.PI/2),G.B.x>PA.width/2-G.B.r&&(G.B.x=0,G.B.y=0,G.B.dir=-gRA(.2*Math.PI,.8*Math.PI),G.B.S=2,G.P.score+=1),G.B.x<-PA.width/2+G.B.r&&(G.B.x=0,G.B.y=0,G.B.dir=gRA(.2*Math.PI,.8*Math.PI),G.B.S=2,G.Q.score+=1),G.B.dir%=2*Math.PI,G.B.dir*=-1,G.B.dir%=2*Math.PI,G.B.dir*=-1,G.B.v={x:Math.sin(G.B.dir),y:Math.cos(G.B.dir)},G.B.v.x<0?G.B.x-G.B.rG.P.y-G.P.height/2&&G.B.y+G.B.r0&&G.B.x+G.B.r>G.Q.x-G.Q.width/2&&G.B.y>G.Q.y-G.Q.height/2&&G.B.y