Skip to content

shivrajcodez/TetrisGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Tetris Game

A modern browser-based implementation of the classic Tetris game built using JavaScript, HTML, and CSS.
This project demonstrates strong fundamentals in game development, grid-based logic, collision detection, and real-time rendering using native browser APIs.


🚀 Overview

This Tetris implementation recreates the iconic tile-matching gameplay experience with smooth controls, structured game logic, and modular code design.

Players control falling tetrominoes, strategically placing them to complete horizontal lines. Completed lines disappear, score increases, and the game progressively becomes more challenging.


🧠 Core Features

  • 🎮 Classic Tetris mechanics
  • ⬅️ ➡️ Smooth horizontal movement
  • 🔄 Tetromino rotation system
  • ⬇️ Soft drop functionality
  • 🧱 Collision detection system
  • 🧮 Line clearing algorithm
  • ⚡ Real-time game loop rendering
  • 🧩 Grid-based board management

🕹️ Controls

Key Action
⬅️ Arrow Move Left
➡️ Arrow Move Right
⬇️ Arrow Soft Drop
⬆️ Arrow Rotate
Spacebar Hard Drop (if implemented)

🛠 Tech Stack

  • JavaScript (ES6+) – Game logic & mechanics
  • HTML5 – Structure
  • CSS3 – Styling
  • Canvas / DOM APIs – Rendering & updates

📂 Project Structure

TetrisGame/ │── index.html # Entry point │── tetris.js # Core game logic │── styles.css # Styling (if included) │── assets/ # Images or rotation visuals


⚙️ How to Run Locally

  1. Clone the repository:
    git clone https://github.com/shivrajcodez/TetrisGame.git
    

Open the project folder.

Double click on index.html or use Live Server for better experience.

No external dependencies required.

💡 Engineering Highlights

This project demonstrates:

Structured state management

Efficient 2D array/grid manipulation

Real-time rendering loop

Clean separation of game logic and UI

Scalable architecture for adding new features

📈 Possible Enhancements

🏆 Score tracking & high score storage (localStorage)

👀 Next piece preview

🔁 Hold piece functionality

🔊 Sound effects & animations

📱 Mobile touch support

🌐 Deployment via GitHub Pages

🎯 Why This Project Stands Out

Unlike basic static projects, this implementation handles:

Continuous game state updates

Dynamic collision detection

Algorithmic line clearing logic

Interactive real-time user input

It reflects strong fundamentals in JavaScript and frontend game architecture — valuable for frontend and full-stack roles.

🤝 Contributing

Pull requests are welcome. If you'd like to improve gameplay mechanics or optimize performance, feel free to fork and enhance.

📄 License

MIT License — feel free to use, modify, and distribute.

About

4A.M and i'm cooking ts!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors