SRS rotation and wall kicks
Separate kick tables for the I piece and JLSTZ group, with offsets tested in order for each rotation attempt.
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.
01 · Goal
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
Separate kick tables for the I piece and JLSTZ group, with offsets tested in order for each rotation attempt.
Every tetromino appears once per bag of seven, avoiding the long droughts produced by naive random selection.
A 500 ms ground timer resets on successful moves and rotations, capped at 15 resets per piece.
T-spin detection uses the 3-corner rule, with back-to-back bonuses for consecutive Tetris and T-spin clears.
Tap to rotate, swipe to move, swipe down to hard drop, and swipe up to hold on phones and tablets.
High score is stored in localStorage, with level progression based on cleared
lines.
02 · Controls
| 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. |
03 · Architecture
| 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
A browser word game with difficulty levels, stats, streaks, and Vue 3 state management.
Keep exploring