Use mouse or touch controls to move paddle around in order to keep ball in reach. You can also compete for higher score.

This game was made for #TweetTweetJam which means, the sourcecode fits inside of 2 tweets (560 chars).I tried to do it with plain javascript .You can see it here (559 chars) :

<canvas id=a height=300><script>c=a.getContext`2d`;x=y=s=150;d=100;j=-1;n=p=0;t=e=>{c.fillStyle=e};r=e=>{c.translate(e,e)};setInterval(e=>{t`black`;c.fillRect(0,0,2*s,2*s);t`white`;j>0&&c.fillText('score:'+j,2,9);r(s);c.rotate(p);c.fillRect(d,-25,9,50);c.rotate(-p);r(-s);c.beginPath();c.arc(x,y,5,0,0.1,1);c.fill();o=Math.atan2(y-s,x-s)-p;h=Math.sqrt((x-s)*(x-s)+(y-s)*(y-s));w=h*Math.sin(o);i=d-h*Math.cos(o);if(w>-25&&w<25&&i<6&&i>=5){n=3.2+p;j++}x+=Math.cos(n);y+=Math.sin(n)},5);ontouchmove=onmousemove=e=>{p=Math.atan2(e.clientY-s,e.clientX-s)}</script>

Comments

Log in with itch.io to leave a comment.

It's very good! But when ball is out canvas, it doesn't display game over or something (i know, 560 char limit).

Very nice! The controls are a little bit strange form me but that's a great idea ... SOLO PONG!