Skip to content

From rags to riches; building Tetris with no programming experience.

License

Notifications You must be signed in to change notification settings

jpillora/tetris-tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello.

The story

My step-brother was playing Tetris today, but was getting annoyed about all the ads and the "recharge time" in the game, and vented his frustration to me. After pointing out that there are probably thousands of completely frustration-free (well, apart from the gameplay) Tetris clones out there, I jokingly told him to go write his own Tetris game instead. His immediate reaction was "I could never do that". After some interrogration, he revealed that he actually thought that doing so could be quite fun, if only there was a good way for him to learn how to do so without studying Computer Science for years. This is my attempt to make that possible.

The game

If all you want to do is play Tetris, there is a working implementation in the root of this repository that you can launch by opening index.html in any modern browser. Just download the code, extract it somewhere, do File->Open in your browser, and select the index.html file. It even implements the Super Rotation System correctly, if you care about that. It's quite rudimentary (no levels, no sound, no "next piece", etc.), but fully playable, and quite small.

The tutorial

The meat of this repository is in doc/, which holds all the tutorial text. You start with the intro, and follow the links from there. I attempt to cover everything from the very basics (what is a variable?) to how to build a complete, working Tetris game, so it is (/will be) quite long, but hopefully it will be a good primer for those trying to get into programming, but who find "introduction to JavaScript" style tutorials completely uninteresting.

Progress

The tutorial is far from finished, but at least the code is there. I'll be writing on this when I have time, and I have many things to do, so I make no guarantees about when new content will be added, nor when (if ever) the entire tutorial will be completed. It's fun to write though, and if people seem to be getting something out of it, I'm more inclined to continue.

Feedback

Yes please! Open an issue using the GitHub issue tracker, send a pull request with improvement suggestions, or just send me an email. I'm not hard to get a hold of.

About

From rags to riches; building Tetris with no programming experience.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.6%
  • HTML 8.4%