Just a test of generating an interactive game. A simple, classic Tetris game built with HTML5 Canvas, CSS, and JavaScript.
- Classic Tetris gameplay with all 7 standard pieces (I, O, T, S, Z, J, L)
- Smooth piece movement and rotation
- Line clearing with scoring system
- Progressive difficulty (speed increases with level)
- Next piece preview
- Pause/resume functionality
- Modern, responsive UI design
- Game over detection
- Open
index.htmlin your web browser - Click the "Start Game" button to begin
- Use the following controls:
- Arrow Keys (← →): Move piece left/right
- Arrow Key (↓): Soft drop (move piece down faster)
- Arrow Key (↑): Rotate piece clockwise
- Spacebar: Hard drop (instantly drop piece to bottom)
- P Key: Pause/Resume game
- Clear horizontal lines by filling them completely with blocks
- Each cleared line awards points based on the current level
- The game speeds up as you advance to higher levels
- Game ends when pieces reach the top of the board
- Single line: 100 × level points
- Multiple lines: 100 × level × number of lines
- Hard drop: 2 points per cell dropped
- Level increases every 10 lines cleared
index.html- Main HTML structurestyle.css- Styling and responsive designscript.js- Game logic and mechanicsREADME.md- This file
This game works in all modern browsers that support:
- HTML5 Canvas
- ES6 JavaScript features
- CSS Grid and Flexbox
Simply open index.html in any modern web browser. No server setup or additional dependencies required!
You can easily customize the game by modifying:
- Colors in the
piecesarray inscript.js - Game speed by adjusting the
dropIntervalvalues - Board size by changing
BOARD_WIDTHandBOARD_HEIGHT - Scoring system in the
clearLines()method
Enjoy playing Tetris! 🎮