Jquery-tetris is a project mainly written in JavaScript, it's free.
Tetris implementation using jQuery
This plug-in converts a <div>
into a tetris playground:
<div id="tetris"></div>
$("#tetris").tetris();
I strived to follow the Tetris Guideline where reasonable, although I tend to call the tetrads "tiles" in the code :)
rows
(default: 22) - number of rows in the tetris areacols
(default: 10) - number of columns in the tetris areatileSize
(default: 16) - the size of a tile (tetrad).tileDrop
- fires when a the current tile has been dropped into placerowCompleted
- fires when a row has been completed and is about to be removedgameOver
- fired when a newly generated tile collides with an existing tilerepaint
- fired when the tile positions are recalculated (pretty much all the time)All tiles are rendered through the DOM, so you can style them with juicy CSS3. Yum!
To build a minified version, you need nodejs. Just run node build/jquery-tetris.js
and the jquery.tetris.min.js will appear.
Licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.