Pong Game with HTML5 Canvas
Here the simple code Pong Game with HTML5 Canvas <div style="text-align:center;"> <canvas id="myCanvas" width="600" height="400" style="border:1px solid #000000;"></canvas> </div> <script> var ky1=0,ky2=0,px=0,py=0,vx=0,vy=0,scorekiri=0,scorekanan=0; var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var lastMouse={x:0,y:0}; var pressedState=false; ky1=ky2=Math.round(0.5*c.height)-30; function drawGame(){ //draw background ctx.beginPath(); ctx.rect(0, 0,c.width,c.height); ctx.fillStyle = "black"; ctx.fill(); //draw middle line ctx.beginPath(); ctx.moveTo(Math.round(0.5*c.width),0); ctx.lineTo(Math.round(0.5*c.width),c.height); ctx.strokeStyle = "white"; ctx.lineWidth = 5; ctx.setLineDash([8,3]); ctx.stroke(); //draw kotak 1 ctx.beginPath(); ctx.rect(0,ky1,20,60); ctx.fillStyle = "white"; ctx.fill(); //draw...

