Vigyata.AI
Is this your channel?

CODE WITH ME | Python TETRIS Game OOP [PART 1]

121.8K views· 4,249 likes· 23:50· Jul 31, 2024

🛍️ Products Mentioned (3)

GitHub Repo: https://github.com/carmensantos/cs-jackie-tetris The first 500 people to use my link https://skl.sh/csjackie07241 will get a 1 month free trial of Skillshare premium! 🤓 about I’m a software engineer based in London with a background in mechanical and aerospace engineering. Most of my time is spent reading, coding and drinking too much coffee. I got into coding by automating simulation workflows and building EdgeSheet.com, and now I’m documenting my life as an engineer on the internet. Thanks for watching! :) 📝 chapters 0:00 intro 0:54 classes and algorithms 2:22 game setup 3:02 define game board 4:41 create shapes 5:34 create tile rotations in memory 7:13 create tile colors 7:37 skillshare 9:04 draw game board 12:58 render random new tile 17:42 move and rotate tiles 22:52 PART 1 recap and PART 2 preview 23:30 outro 📝 contact info@csjackie.com 🎵 music the music in my videos comes from: https://share.epidemicsound.com/5swi7a 👀 disclaimer Views and opinions are my own and do not represent or reflect the opinions of my current or past employer(s). This video is sponsored by Skillshare. 🏷 hashtags & video content Software engineer, tetris game, python game, pygame, code with me, coding vlog, coding video, programming, software engineering, developing software, pandas, data structures and algorithms, tetris #tetris #pythonprogramming #softwareengineer

About This Video

In this Code With Me, I challenged myself to start building a Python Tetris game using Pygame—and I’ll be honest, this is not a step-by-step tutorial. These videos are more about me picking a project that feels slightly too hard, breaking it down, and learning in public so you feel motivated to do the same. Because Tetris has a lot of moving parts, I decided to structure it with OOP: I sketched out the core classes I’d need (board, tile, shapes/rotations, and eventually the “ground” for deposited pieces), plus the algorithms that make Tetris feel like Tetris—movement, rotation, collision detection, and row clearing. In Part 1, I set up a fresh repo and virtual environment, installed dependencies, and built the game scaffolding: the board matrix, screen rendering, and a Tetris “game” class with a clock so pieces fall at a steady speed. I also created all the tetromino shapes as coordinate sets inside a 4x4 grid, stored their rotation states in memory, and added a color palette so the game looks nice. By the end, I’m randomly spawning tiles, rendering them on the board, and handling keyboard input to move left/right/down and rotate—plus debugging classic Pygame gotchas like rerender order and accidentally overwriting state. Next up in Part 2: ground logic, collision detection, and clearing completed rows with cascading.

Frequently Asked Questions

🎬 More from CS Jackie