606 bytes pong
Tiny source code of 606 bytes of javascript pong game.
Here is all the code:
<h1>You lost!</h1><canvas id="c"style="position:absolute;left:0;top:0;filter:invert(1);background:white;"><script>var c=document.getElementById("c"),w=window.innerWidth,h=window.innerHeight,x=c.getContext("2d"),r=requestAnimationFrame,X=300,Y=0,p=0,v=3,V=3,C=()=>{x.clearRect(0,0,w,h)},L=(t)=>{if(X+10>w||X<0)v=-v;if(Y+10>h)V=-V;if(Y<0)c.remove();if(X<p+100&&X+10>p&&Y<10+10&&10+Y>10)V=-V;X+=v;Y+=V;C();r(L);x.fillRect(X,Y,10,10);x.fillRect(p,10,100,10);};c.width=w;c.height=h;r(L);document.onkeydown=(e)=>{p+=e.keyCode==37?-(38-e.keyCode)*10:e.keyCode==39?-(38-e.keyCode)*10:0;console.log("a");};</script>
Status | Released |
Platforms | HTML5 |
Author | Retro pigeon |
Leave a comment
Log in with itch.io to leave a comment.