Browser game Vanilla JavaScript No game engine

Tetrish

A Tetris-style browser game built from Web platform primitives. It implements modern guideline behaviors like SRS rotation, 7-bag randomization, lock delay, T-spin scoring, and touch controls.

A clone that respects the details players notice.

Many browser block-stacking games get the broad shape right but skip the rules that make modern Tetris feel predictable: wall kicks, 7-bag piece distribution, lock delay, hold behavior, and T-spin scoring.

Tetrish was an exercise in building that behavior directly in JavaScript. The core gameplay logic has no runtime dependencies. Animation and background effects stay outside the board, piece, scoring, and input systems.

Guideline behavior

The small rules shape the feel of the game.

SRS rotation and wall kicks

Separate kick tables for the I piece and JLSTZ group, with offsets tested in order for each rotation attempt.

7-bag randomizer

Every tetromino appears once per bag of seven, avoiding the long droughts produced by naive random selection.

Lock delay and move reset

A 500 ms ground timer resets on successful moves and rotations, capped at 15 resets per piece.

T-spin and back-to-back scoring

T-spin detection uses the 3-corner rule, with back-to-back bonuses for consecutive Tetris and T-spin clears.

Touch controls

Tap to rotate, swipe to move, swipe down to hard drop, and swipe up to hold on phones and tablets.

Persistent score

High score is stored in localStorage, with level progression based on cleared lines.

Keyboard and touch are both first-class inputs.

Input Action
Left / Right Move the active piece horizontally.
Down Soft drop.
Up Rotate clockwise.
Space Hard drop.
C Hold piece.
Tap and swipe Touch equivalents for rotate, move, hard drop, and hold.

The board, input, scoring, and state are separate modules.

Module Role
main.js Game loop, piece actions, and orchestration.
board.js DOM grid, collision, line clearing, and T-spin detection.
pieces.js Tetromino shapes, SRS rotation, and wall kick tables.
controls.js Keyboard and touch input normalization.
score-manager.js Score, level, back-to-back chain, and high score persistence.
sound-manager.js Web Audio clips, volume, mute state, and teardown.

Related

More browser games.

Wordleish

A browser word game with difficulty levels, stats, streaks, and Vue 3 state management.

Related paths.