JSTetris
A JavaScript implementation of the classic game Tetris that uses images for the blocks. Licensed under the GNU General Public License.
© Benn Herrera 2003, 2004
About the Game
JSTetris is a browser-based Tetris clone written entirely in JavaScript. Unlike text-based or canvas-only implementations, this version uses actual images for the block pieces, giving each tetromino a distinct visual style.
The game requires JavaScript execution to run. Once loaded, it tracks your score, advances through levels, and maintains a high-score table stored locally in your browser.
JSTetris represents an early creative experiment in browser-based game development, using JavaScript to recreate the classic block-stacking puzzle with a distinctive visual approach. Rather than relying on simple colored squares or canvas rendering, this implementation uses actual image files for each tetromino piece, giving the falling blocks a unique, textured appearance. The game tracks the player's score, advances through progressively challenging levels, and maintains a local high-score table that persists in the browser. This project reflects a period when web developers were pushing the boundaries of what could be accomplished with client-side scripting alone, before modern frameworks and hardware acceleration became commonplace. It stands as a testament to inventive problem-solving within the constraints of early web technologies.
The game's architecture demonstrates a thoughtful approach to cross-browser compatibility, a significant concern during its development era. By embedding images directly for each block type, the developer ensured that the visual identity of every tetromino remained consistent regardless of the user's browser or operating system. The JavaScript code handles game logic including piece rotation, line clearing, collision detection, and scoring mechanics entirely on the client side. This self-contained method of incorporating game elements into a web page without external plugins or server-side processing was an innovative approach at the time. The project also includes a skeleton structure that could be adapted or expanded upon by other developers interested in understanding how browser-based games functioned in the early days of the web.
The creative use of images for game pieces gives JSTetris a charming, handmade quality that distinguishes it from more modern, polished implementations. Each tetromino block carries its own visual character, adding personality to the familiar gameplay loop of arranging falling shapes into complete rows. The project, released under an open-source license, invites exploration and modification by anyone interested in game development or JavaScript programming. It serves as both a functional game and a historical artifact of web development practices from an earlier period, when developers had to be resourceful with limited tools and browser capabilities. For those interested in how classic games were adapted for the early web, this implementation offers insight into the creative methods developers used to bring interactive experiences to the browser.
Features
Score & Levels
Real-time score tracking with progressive difficulty levels as you clear more lines.
High Scores
Persistent high-score table with player names, stored locally in your browser.
Custom Images
Supply your own image set for the blocks by specifying a folder URL, number of images, and format.
Restore Defaults
Quickly reset to the original block images with a single click.
Controls
The game supports a range of keyboard shortcuts for both left- and right-handed play:
| Action | Keys |
|---|---|
| Rotate Left | S, K |
| Rotate Right | D, L |
| Move Left | A, J |
| Move Right | F, ; |
| Rush / Drop | Space, Enter |
| Start Game | F12 |
| End Game | Esc |
License
JSTetris is © (CopyLeft) Benn Herrera 2003, 2004, released under the terms of the GNU General Public License.
For source code inquiries, contact benn@bennherrera.com.