- Author:
- Gaëtan Burg
- Twitter:
- @
- GitHub:
- tag9724
- Facebook:
- Google+:
- +
- Reddit:
- /r/
- Pouet:
- Website:
- Compo:
- pure
- Demo link:
- https://js1k.com/2017-magic/demo/2668
- Shortlink:
- https://js1k.com/2668
- Blog post:
- please update here!
- Bytes:
- 908
- Chars:
- 908
- Submission
_='b4<R*{ovf6w:hidd7;us-sQ:ne$size:2vw$family:mospace;text-align:c}i{hw;f6at:ft}p,.s{fx;backg:#000;curs:po&t;col:#eee}p;posi:fixed;%%;b6ck;p&g-top:20vh;}b}@R<b>@b>";M=Math;d=docum;I=[];l=d.quySQbKs=o=r=0;t=2e3;C(ee=BtargetDf(e||BparUs+=1;N( t+=+(1e3-s)*.35}}N(movesKn=o;whi(n==oo=J(Jrandom()*8)}sKPl)}f(t i=0,eD<9D++e=d.cateUiKBEvLi7c\',C I[i]=e;be }A(h=pf?ncBnow( t=J?x(0,J(t-=(h-r)) r=h;l4Time ft "+t+"ms"+sDf(!tb+=\'<p>G Ov\'+s+\'<a c4top.6ad()">C he f art@a>@p>\';turn false}queAni?Fr(A)}N( A().&nHTMLfunc .class.app7dChild({?rg&:autole7ter );<br>N=4s"PLi.roundonordisplay:){lickheight:;width:streSce (\'100addameti33.3v$;ft-&in4="6lo7en?ma@</Be.D;iJM.K\' PI[o]QectRy>UEm';for(Y in $='URQPKJDB@?764&$ ')with(_.split($[Y]))_=join(pop());eval(_)
- Description
- Click quickly on the black boxes before the time end !
Oh-Click is a really simple game who's run without canvas and basics js skills.
In fact I just woke up this morning thinking of a kind of clickable sudoku done in javascript with less than 1024 characters ...
Anyway, it's not the most impressive 1KJS project but it was fun to made and it's fun to play, hope you enjoy it.
- Base64 encoded
Xz0nYgE0PFIqe292CGY2dzpoaWRkNzt1cwgtc1E6bhBlJHNpemU6MnZ3JGZhbWlseTptEG9zcGFjZTt0ZXh0LWFsaWduOmMHCH1pexUfaBYfdztmNmF0OgZmdH1wLC5zexJmBng7YmFja2cPOiMwMDA7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YWwoXyk=
- Original source
b.innerHTML = "<style>*{overflow:hidden;user-select:none;font-size:2vw;font-family:monospace;text-align:center}i{height:33.3vh;width:33.3vw;float:left}p,.s{display:flex;background:#000;cursor:pointer;color:#eee}p{margin:auto;position:fixed;height:100%;width:100%;display:block;padding-top:20vh;}b{margin:auto}</style><b></b>";
M = Math;
d = document;
I = []; // Contain all boxes ( <i> tag )
l = d.querySelector( 'b' ); // Select the timer
s = o = r = 0; // s = score | o = current black box | r = used for the timer
t = 2e3; // timer ( 2e3 used instead of 2000 )
/* Click event function */
function C( e ) {
e = e.target;
if ( e.className == "s" || e.parentElement.className == "s" ) {
s += 1;
N();
t += 100 + ( 1e3 - s ) * .35
}
}
/* Reset and set the next black box */
function N() {
// Set the current black box white
I[ o ].classList.remove( 's' );
// Current black box can't be used 2 consecutive time
n = o;
while ( n == o ) {
o = M.round( M.random() * 8 )
}
// Set the new black box and append the timer on it
I[ o ].classList.add( 's' );
I[ o ].appendChild( l )
}
/* Init ( append all clickable boxes ) */
for ( let i = 0, e; i < 9; i++ ) {
e = d.createElement( 'i' );
e.addEventListener( 'click', C );
I[ i ] = e;
b.appendChild( e );
}
/* Timer animation & Game Over */
function A() {
// Update timer
h = performance.now();
t = M.max( 0, M.round( t -= ( h - r ) ) );
r = h;
// And display it
l.innerHTML = "Time left " + t + "ms<br>Score " + s;
// Game over screen when t reach 0
if ( !t ) {
b.innerHTML += '<p>Game Over<br>Score ' + s + '<br><br><a onclick="top.reload()">Click here for restart</a></p>';
return false
}
requestAnimationFrame( A )
}
N();
A()