This is a classic Tetris game implemented in Python using the Pygame library. The game offers a traditional Tetris experience with falling tetrominoes that you can control to complete lines and score points.
- Python 3.x
- Pygame library
-
Clone the repository:
git clone https://github.com/your-username/tetris-game.git
-
Install the required dependencies:
pip install pygame
Navigate to the project directory and run the following command:
python main.py
-
Controls:
- Use the
left
andright
arrow keys to move the falling tetromino sideways. - Press the
up
arrow key to rotate the tetromino clockwise. - Use the
down
arrow key to speed up the falling of tetrominoes. - Press
ESC
to exit the game.
- Use the
-
Aim:
- Fill complete lines horizontally to make them disappear and earn points.
- Avoid reaching the top of the screen; the game ends if the tetrominoes stack up to the top.
The project contains the following main files:
main.py
: Contains the game's main logic and setup.settings.py
: Includes various game settings and configurations.tetris.py
: Manages the Tetris game mechanics and rendering.tetromino.py
: Defines the tetromino blocks and their behavior.
- Changing Tetromino Shapes:
- Modify the
TETROMINOES
dictionary insettings.py
to create different shapes for tetrominoes.
- Modify the
- Adjusting Game Settings:
- Explore
settings.py
to tweak game-related constants, such as speed, colors, and screen dimensions.
- Explore
Special thanks to the Pygame community and the creators of Tetris for the inspiration.
Happy gaming! ๐