Skip to content

marvy-ian/python-tetris-game-using-pygame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris (Python / Pygame)

A clean, single-file implementation of Tetris built with Pygame. Features standard 7-piece shapes, wall kicks, ghost piece preview, hold, next-piece preview, scoring, leveling, and pause/restart support.

Screenshot

Features

  • All 7 tetrominoes (I, O, T, S, Z, J, L) with accurate rotation states
  • Ghost piece showing where the current piece will land
  • Hold a piece for later (with swap support)
  • Next piece preview
  • Wall kicks on rotation (simple kick table)
  • Scoring system based on lines cleared and current level
  • Progressive difficulty — drop speed increases as you level up
  • Pause and restart support
  • Sidebar HUD showing score, level, lines cleared, hold/next pieces, and controls

Requirements

Installation

git clone <your-repo-url>
cd <your-repo-directory>
pip install pygame

Usage

Run the game with:

python main.py

Controls

Key Action
/ Move left / right
Rotate clockwise
Z Rotate counter-clockwise
Soft drop
Space Hard drop
C Hold piece
P Pause / resume
R Restart

Scoring

Lines cleared Points (× level)
1 100
2 300
3 500
4 (Tetris) 800

Soft dropping and hard dropping also award small bonus points per cell traveled. Your level increases every 10 lines cleared, which increases drop speed.

Project Structure

.
├── main.py            # Game logic, rendering, and main loop
├── README.md
├── CONTRIBUTING.md
└── CODE_OF_CONDUCT.md

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines on how to get started.

Code of Conduct

This project follows a Code of Conduct to ensure a welcoming environment for all contributors.

License

This project is currently unlicensed. Add a LICENSE file to specify how others may use, modify, or distribute this code.

About

A modern Tetris game built with Python and Pygame. Features smooth gameplay, wall kicks, ghost pieces, hold and next piece systems, scoring, level progression, procedurally generated sound effects, and responsive controls.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages