Tetris
By Just Sparrow
About
A polished, mobile-first Tetris clone built as a single self-contained HTML file. Features the full classic ruleset — 7-bag random piece generation, wall-kick rotation, soft drop, hard drop, ghost piece preview, line-clear scoring, and progressive level speed-up. The UI uses a neon cyan/magenta aesthetic with gradient blocks, a glowing playfield border, and an info panel showing Score, Lines, Level, and the Next piece. Procedurally generated sound effects (Web Audio API) play on every move, rotation, drop, lock, line clear, level up, and game over — no external audio files required.
Prompt Used
A cross-platform Tetris game with keyboard controls on desktop, correctly-positioned arrow-shaped touch buttons on mobile, sound effects, and a one-click start screen.
How to Use
Start the game
- Tap the big START button on the title screen — that's it, no extra menus.
Mobile controls (on-screen buttons below the board, laid out like a real D-pad):
- ◀ / ▶ — move left / right (hold to repeat)
- ▼ — soft drop (hold to repeat)
- ▲ — rotate clockwise
- DROP — hard drop (instant slam to the bottom)
- Pause / Restart — buttons on the side panel
Keyboard controls (desktop):
←/→orA/D— move↓orS— soft drop↑orW— rotateSpace— hard dropP— pause / resume
Scoring
- Single = 100 × level, Double = 300 × level, Triple = 500 × level, Tetris = 800 × level
- Soft drop awards +1 per row, hard drop awards +2 per row
- Every 10 lines cleared advances the level and speeds up gravity (down to a minimum drop interval)
More
- Ghost piece — a translucent outline shows where the current piece will land
- Wall kicks — rotation tries small horizontal nudges (±1, ±2 cells) so pieces can rotate flush against walls
- 7-bag randomizer — each "bag" of 7 pieces contains one of each tetromino, shuffled, so droughts and floods are bounded
- No assets, no dependencies — pure HTML/CSS/JS in one file; sounds are synthesized live via oscillators
- Mobile-locked viewport — uses
vwunits throughout so the layout scales identically on any phone width - Pause confirmation — restarting mid-game asks YES / NO so you don't lose a good run by accident
Loading comments...
Other Codes
No other codes yet