Skip to content

Latest commit

 

History

History
92 lines (66 loc) · 3.04 KB

README.md

File metadata and controls

92 lines (66 loc) · 3.04 KB

London Python Dojo - Tetris

The task for tonight is to create a clone of Tetris. This page lays out some of the decisions and tasks.

This is an aid to coordinating as a remote team.

Game engine

You will need to decide on a 2D game framework. Some candidates are:

I would not recommend these for this project:

  • Pygame - you will have to write a game loop and event handling yourself before beginning.
  • Pyglet - being lower-level to OpenGL, this does not have a simple API for polygon/rectangle drawing, only sprites and text.

Tasks

The following tasks are split up according to a "Model-View-Controller" pattern to make it easier to visualise the dependencies between the tasks, but this is not the only way (and may not be the best way) to write the game.

Model

  1. Describe the seven tetronimo pieces (as described here).
  2. Generate a random piece. Show the next piece that will be generated.
  3. Rotate a tetronimo. This requires a centre of rotation for each tetronimo. See here for a description of this in the official games.
  4. Model the grid of filled cells.
  5. Allow testing whether a tetronimo intersects filled cells at a given position.
  6. Write a tetronimo into the filled cells.
  7. Remove each line that is filled and collapse lines above.
  8. Keep score.

View

  1. Create a game window.
  2. Draw the boundary of the play area.
  3. Draw the filled cells.
  4. Draw the active tetronimo.
  5. Draw the next tetronimo to drop.
  6. Animate the removal of a line.
  7. Show the score.
  8. Allow drawing "game over" over the screen.

Controller

  1. At the start of the game, make the next tetronimo the active tetronimo.
  2. Drop one step every t seconds. If the tetronimo cannot occupy the space below it, write it into the filled cells. Trigger an animation if a line is filled. Then make the next tetronimo active.
  3. Add keys for left/right. These do nothing if there is no space for the tetronimo.
  4. Add keys for rotate clockwise/anticlockwise. These do nothing if there is no space for the rotated tetronimo. At the walls, tetronimos may be moved outwards to accomodate the rotation.
  5. If there is no room to introduce the active piece, show game over.
  6. On the game over screen, press a key to restart.
  7. Implement the "drop all the way" operation.

Publication

  1. Describe requirements in a requirements.txt
  2. Write a README.

Stretch goals

  1. Animate the rotation of the pieces.
  2. Animate the drop operation(s).
  3. Make the game speed increase very slowly (logarithmically?)
  4. Add juice - screen shake, trails, particles, sound effects.
  5. Add a title screen.
  6. Publish to PyPI.