Step 3: The Block class

Add a new class to represent and draw individual square blocks in the Tetrominos game.

Each falling piece in Tetrominos is made up of four small blocks arranged in a particular way. Let’s write and test the Block class. Create a new file in your project called To get you started, here’s a skeleton of the code, which you may copy in:

Get hands-on with 1200+ tech skills courses.