The Tetris game, implemented in Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
resources
.gitignore
LICENSE.md
README.md
build_linux.sh
build_mac.sh
build_windows.bat
game.py
helpers.py
requirements.txt
run.py
save_game_manager.py
screenshot.png
settings.py
stats_manager.py
tetriminos.py

README.md

Tetris

The Tetris game, implemented in Python.

Features

  • All the Tetris rules
  • State of the art graphics
  • Automatic game saving when quitting. If there's a saved game it is automatically loaded, too
  • Ability to pause the game
  • Stats
  • Sound effects!
  • Musics!

Prerequisites

Python 3. May eventually works with Python 2 (not tested).

Installation

Clone this repo, and then the usual pip install -r requirements.txt.

Usage

python run.py

Controls

  • ESC closes the game
  • PAUSE pauses the game
  • F1 starts a new game
  • F2 displays stats
  • and moves the Tetrimino respectively to the left and to the right
  • rotates the Tetrimino
  • makes the Tetrimino to fall faster

How it works

This game is built on top of PyGame. I obviously can't explain how it works here, so you'll have to jump yourself in the source code. Start with the entry point, run.py.

Beside the game itself, I use PyInstaller to generate the executables. It packs up all the game and its assets in a single executable file so players just have to run it with nothing to install. This task is performed by the build_* scripts to be run in the corresponding OS.

Scoring

Each completed lines is worth 10 points. If you have completed 4 lines at once (also called a "tetris"), the score is doubled, so (4 lines x 10 points) x 2 = 80 points. If there's no more blocks on the playground once you have removed lines, the score is also doubled. Taking the previous example: 80 points x 2 = 160 points.

Levels

You get to the next level every 8 completed lines. Tetriminos will fall 100 milliseconds faster for each gained levels (they are initially falling for one block down every 1 second).

Credits

  • Icon by Everaldo Coelho (LGPL)
  • Font by Typodermic Fonts Inc (freeware)
  • Sound effects by Kenney (CC0 1.0 Universal)
  • Musics by SoundImage.org (Royalty-Free)
  • Tetris™ and Tetriminos™ are trademarks of The Tetris Company. This project isn't supported nor endorsed by The Tetris Company

End words

If you have questions or problems, you can submit an issue.

You can also submit pull requests. It's open-source man!