Skip to content

Instantly share code, notes, and snippets.

@gullyn
Last active June 5, 2021 11:25
Show Gist options
  • Save gullyn/9ae34455cb0cf87989f189871dd4351e to your computer and use it in GitHub Desktop.
Save gullyn/9ae34455cb0cf87989f189871dd4351e to your computer and use it in GitHub Desktop.
Breakout in 360 bytes
<body onload="u=l=m.getContext`2d`;onkeydown=e=>k=e.which-38;setInterval(`l||b>w?(q=k=l=0,a=p=v=50,b=5e2,c=d=2):p+=k*2;m.width=m.height=w=610;a+=c-=a<0|a>w?2*c:0;b-=d-=b<0|(a>p&a<p+v&b>590)?d*2:0;for(i=-1;++i<30;x=i%10*60,y=~~(i/10)*20,!(q&2**i)&&${f='u.fillRect('}x,y,v,j=15),x<a&a<x+v&b>y&b<y+j&&(q|=2**i,d=-d));${f}p,590,v,j);${f}a,b,9,9)`,9)"><canvas id=m>
@gullyn
Copy link
Author

gullyn commented Jun 5, 2021

Jsfiddle: https://jsfiddle.net/3cduxr61

Controls: left & right arrow keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment