||7 months ago|
|.gitignore||3 years ago|
|README.md||10 months ago|
|cs1graphics.py||7 months ago|
|screenshot.png||10 months ago|
|tetris.py||7 months ago|
A simple tetris game using the cs1graphics library (cs1graphics.org) written in python
How to play
After starting the program the game immeadeatly starts.
You can control it using your usual
wasd or the less usual
ijkl as arrow keys.
If you hit the
space key the falling pice will go to its final psoition.
p pauses the game,
R resets the game and
Q quits the game.
Before talking avout the code, Apologies for the german names, this started as a school project for learning python.
The color scheme is defined in a dictionary called
color_sceme near the end of the file. The color names are passed to cs1graphics, so look at their documentation for a reference sheet.
Look at the while loop at the end of the file, there is a call to the sleep function which defines the game speed.
To modify which shapes can fall from the sky there is an array that gets passed to the
Steingenerator class which contains the names of the tiles in the game.
The mapping from name to shape happens in the
Stein class in the
The mapping from pressed keys to commands happens in the
handle function of the
The commands are interpreted in the
cmdCallback function of the