Skip to content

A classic Tetris game implementation using pure JavaScript, HTML5 Canvas and CSS. This project demonstrates core web development concepts including DOM manipulation, Canvas API, keyboard event handling, and game physics without any external libraries or frameworks.

Notifications You must be signed in to change notification settings

trzaskos/vanilla-js-tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vanilla JS Tetris

A classic Tetris game implementation using pure JavaScript, HTML5 Canvas, and CSS without any external libraries or frameworks.

Tetris Game Screenshot

🎮 Demo

You can play the game directly here (add your deployment link once available).

✨ Features

  • Complete Tetris gameplay mechanics
  • Score tracking system
  • Level progression (speed increases)
  • Line clearing and scoring
  • Next piece preview
  • Game pause functionality
  • Responsive design
  • Keyboard controls

🛠️ Technologies Used

  • Vanilla JavaScript (ES6+)
  • HTML5 Canvas API
  • CSS3
  • No external libraries or frameworks

🕹️ How to Play

Controls

  • ←/→ Arrow Keys: Move piece left/right
  • ↑ Arrow Key: Rotate piece
  • ↓ Arrow Key: Soft drop (faster fall)
  • Space Bar: Hard drop (immediate placement)
  • P: Pause/Resume game

Scoring

  • 1 line: 40 × level
  • 2 lines: 100 × level
  • 3 lines: 300 × level
  • 4 lines: 1200 × level

🚀 How to Run Locally

  1. Clone this repository:

    git clone https://github.com/trzaskos/vanilla-js-tetris.git
    
  2. Navigate to the project directory:

    cd vanilla-js-tetris
    
  3. Open index.html in your browser.

No build process or dependencies required!

Known Bugs

  • Tetromino pieces don't fully reach the right edge of the game board. This is a known limitation in the current implementation that will be addressed in future versions.

📝 Future Improvements

  • Mobile touch controls
  • Sound effects
  • High score persistence using localStorage
  • Animated line clears
  • Hold piece functionality
  • Different difficulty modes

🤝 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgements

  • The original Tetris game created by Alexey Pajitnov
  • Various Tetris guidelines that have evolved over the years

Feel free to fork this project and make your own improvements!

📧 Contact

Maryele Trzaskos Gruber - [email protected]

Project Link: https://github.com/trzaskos/vanilla-js-tetris

☕ Support

If you find this project helpful, consider buying me a coffee!

Buy Me A Coffee

About

A classic Tetris game implementation using pure JavaScript, HTML5 Canvas and CSS. This project demonstrates core web development concepts including DOM manipulation, Canvas API, keyboard event handling, and game physics without any external libraries or frameworks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published