A classic Tetris game implemented in Python using the Pygame library. This game features traditional Tetris gameplay with a graphical interface, including a welcome screen, game over screen, and touch controls.
- Classic Tetris gameplay with seven types of pieces.
- Adjustable game speed based on level.
- Welcome screen with username input.
- Game over screen with the option to restart.
- Touch controls for mobile devices.
- Simple and intuitive user interface.
- Python 3.x
- Pygame library
-
Clone the repository:
git clone https://github.com/arad1367/tetris_game_huggingface.git
-
Navigate to the project directory:
cd tetris_game_huggingface
-
Install the required Python packages:
pip install -r requirements.txt
-
Download background image
- The game requires a background image named tetris7.png to be placed in an images directory. Ensure the image file is present at
images/tetris7.png
.
- Run the game
python app.py
- Arrow Keys: Move the Tetris piece left, right, or down.
- Up Arrow: Rotate the Tetris piece.
- Spacebar: Drop the Tetris piece to the bottom.
- Touch Controls: On touch devices, tap the left or right side of the screen to move the piece, and tap the bottom to move it down. Tap the top to rotate.
- Objective: Rotate and move the falling Tetris pieces to create complete lines across the grid. Complete lines are cleared, and you score points.
- Game Over: The game ends when new pieces cannot be placed on the grid.
- If you want to contribute to this project, please fork the repository and submit a pull request. For major changes, please open an issue first to discuss what you would like to change.
For Hugging face deployment:
- Make a new space
- Use static template - blank
- Upload
index.html
, images and music.
- This project is licensed under the MIT License
- The Pygame library for creating the game interface and handling user input.
- The classic Tetris game concept and design.
- Thanks to Hugging face foe easy 5 stars deploy
- The Tetris Theme A music is based on an old Russian folk song called "Korobeiniki" and was adapted for the classic game Tetris by Hirokazu Tanaka.
- For any questions or feedback, please contact pejman.ebrahimi77@gmail.com
Happy gaming!