This repository contains a Tetris game implemented in Python, using the Pygame library.
- Install the required dependencies by running
pip install -r requirements.txt. - Run
python tetris.pyto start the game.
- Left arrow: Move the tetromino left.
- Right arrow: Move the tetromino right.
- Up arrow: Rotate the tetromino.
- Down arrow: Move the tetromino down faster.
main.pycontains the main game loop and handles user input as well as game logic.- The
Tetrominoclass is responsible for handling individual tetromino shapes, rotations and collisions. Each shape has its own color, shape templates and rotation rules. - The
Gridclass is responsible for the game grid, adding tetrominos to the grid, clearing lines and detecting if the game is over. - Colors, dimensions and intervals can be found at the beginning of the code, where they can be easily adjusted as needed.
Happy gaming!