Last active
June 5, 2021 11:25
-
-
Save gullyn/9ae34455cb0cf87989f189871dd4351e to your computer and use it in GitHub Desktop.
Breakout in 360 bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jsfiddle: https://jsfiddle.net/3cduxr61
Controls: left & right arrow keys