
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
What does that pygame library do and how to install it using pip
Create the window that will contain the game
Define the grid, initialize the game matrix, loop to populate rows, then draw the board rectangle with pygame using blue color, a start position, and the appropriate width and height.
Create a single tetris piece represented by a dictionary, set its initial position to (0,0), and move the piece down every second using a create_piece function.
Draw a red and white two-rectangle Tetris piece in pygame, calculating start positions with margins, line thickness, and spacing, then move it down each second via a last-time check.
Learn to stop the Tetris piece when it reaches the bottom or a filled cell, update the grid, draw the border, and spawn a new piece at the top.
Explore a possible solution for updating the game matrix and moving the piece. Implement draw border and draw single digits block to render the board and enable left-right input.
Handle pygame key down events to move the falling tetris piece left or right, then call the is_valid_position function to ensure the move stays on the board.
Set the drop pace and manage piece labels in pygame, call piece functions, save the selected label to a property, and implement the block drop to draw a tetris piece.
Presents a solution that computes base metrics, loops over cells, and moves empty cells to valid positions, validating with a check function, before applying real Tetris pieces and rotating spaces.
In this section we will cover how to make the moving piece rotate when we press the UP key
Some possible improvements you can make to your game to practice and get the most out of the course
This course is for anyone who just started learning programming and is bored of repeating book exercises over and over and want to move to more exciting project. In this course you will gradually build a tetris game while improving your programming skills. Hand-on course meaning you will start creating the game straight away without going through hours of game development theory.