ttencate / tis

An embeddable Tetris clone without dependencies in 4 kB of JavaScript
http://ttencate.github.io/tis
BSD 3-Clause "New" or "Revised" License
139 stars 16 forks source link

Tis

Play Tis here, with the source code in the background.

Tis is a self-contained Tetris® clone in 4 kB of pure JavaScript (ECMAScript 5). This includes code to generate the necessary HTML markup and inline CSS.

Tis can be embedded into any web page by simply adding a <script> tag. It can then be invoked as an easter egg using the Konami code.

Features

Tis has nearly all of the features you might expect from a modern Tetris:

Missing features

Deploying

Simply grab tis.min.js from this repository, put it on your webserver somewhere, and put the following just before the </body> tag in your HTML:

<script src="https://github.com/ttencate/tis/raw/master/path/to/tis.min.js"></script>

Visitors of your web page will now get a nice surprise when they type the Konami code.

Implementation notes

To keep the code at least somewhat sane, it relies on UglifyJS for variable renaming, brace removal and more such niceties. However, there was still plenty to be done by hand. This section describes some of the tricks used.

HTML/CSS

Game data

JavaScript