
Show HN: Quick JavaScript Tetris – Based on Yesterday's Show HN - sacert
https://github.com/sacert/Quick-Tetris
======
sacert
After seeing yesterday's Show HN about building a Tetris game on a game, I
decided to take a crack at it and build it within a short time frame before I
went back to studying for my midterm. I rarely code in JavaScript so it added
to the challenge. Several features are missing but I am satisfied with what I
accomplished during my coding session.

~~~
wmichelin
Nice

------
vinay427
I experienced a bug where the game suddenly stops after a few minutes of
playing. I'm using Firefox ESR 45.4.0 on RHEL if it helps. Otherwise, great
job!

~~~
sacert
Thanks for pointing it out, I'll look into it.

~~~
mrpopo
Seconding that, Firefox 49 on Windows7.

~~~
krusty76
Thirded w/ Chrome 54.0.2840.87 (64-bit) on OS X 10.11.6. Stopped about 15
pieces in the first time so I thought it was just an abbreviated demo.

------
rahkiin
Could you make it work on mobile (esp. touch screens)? Something where arrows
are swipes?

~~~
sacert
That is quite interesting, I didn't really think about mobile capabilities
while making this but it would be a fun thing to add. I'll look into it after
my exam tomorrow!

------
nothrows
Love these short 1 file code things.

C
[https://gist.github.com/spaceexperiment/4d6b116ef577a2971259...](https://gist.github.com/spaceexperiment/4d6b116ef577a29712593c41747bd092)

Tcl
[https://gist.github.com/nickbarth/cba8cc9996cc3ebe8427726fae...](https://gist.github.com/nickbarth/cba8cc9996cc3ebe8427726faede9956)

------
lanius
>I set my deadline as the time before I had to start studying for my midterm

Ah, procrastination ;)

------
ronilan
Super nice. I had to look in the code to find this:

    
    
      Up arrow to rotate!

~~~
oneeyedpigeon
Fine idea, but it needs to cancel the default event because otherwise the page
scrolls up when you rotate a piece.

~~~
sacert
Good point, I just implemented a fix for that

------
KiDD
I love Tetris! Played it for a few minutes. Time to attach to blocks shouldn't
be instant and I had the top and right game borders start flashing after a
while but otherwise pretty cool!

------
brockwhittaker
Consider wrapping your code in a closure so that all the variables and
functions aren't globals. It's good performance-wise and for not polluting the
global namespace.

Otherwise looks good. :)

------
intralizee
It would be nice to see what the next block is going to be.

------
lacampbell
I feel like delay you get when rotating the blocks is too short. I often ended
up over-rotating it. Might just be me.

Other than that good job.

------
bartl
The playing field is higher than the client area of my browser. (768px pix
screen)

~~~
sacert
Valid point, just added a resizing function so it should be fine now.

