Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris Game

Just a test of generating an interactive game. A simple, classic Tetris game built with HTML5 Canvas, CSS, and JavaScript.

Features

  • 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

How to Play

  1. Open index.html in your web browser
  2. Click the "Start Game" button to begin
  3. 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

Game Rules

  • 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

Scoring System

  • 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

Files Structure

  • index.html - Main HTML structure
  • style.css - Styling and responsive design
  • script.js - Game logic and mechanics
  • README.md - This file

Browser Compatibility

This game works in all modern browsers that support:

  • HTML5 Canvas
  • ES6 JavaScript features
  • CSS Grid and Flexbox

Running the Game

Simply open index.html in any modern web browser. No server setup or additional dependencies required!

Customization

You can easily customize the game by modifying:

  • Colors in the pieces array in script.js
  • Game speed by adjusting the dropInterval values
  • Board size by changing BOARD_WIDTH and BOARD_HEIGHT
  • Scoring system in the clearLines() method

Enjoy playing Tetris! 🎮

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages