This is a Tetris game built entirely from scratch using C# and WPF (Windows Presentation Foundation). It features custom block logic, a scoring system, held pieces, and colorful sprite-based graphics.
This was a personal project to strengthen my object-oriented programming skills and deepen my understanding of game loops, UI rendering, and state management in C#.
- Classic Tetris rules with rotation, hold piece, and scoring
- 7 tetromino types (I, J, L, O, S, T, Z) each with rotation logic
- Grid-based collision detection
- Block queue & held piece functionality
- Custom game loop
- Visual design using PNG tile sprites
007-WPF-tetris-game
β
βββ Assets/ # All PNG sprite files (blocks, background, icon)
βββ backend/ # (If needed for expansion, not used here)
βββ .vs/, bin/, obj/ # Build folders (ignore)
βββ Block.cs # Abstract Block class & movement logic
βββ BlockQueue.cs # Handles next piece & randomizer
βββ GameGrid.cs # 2D grid management, full row logic
βββ GameState.cs # Core gameplay logic (score, game over, etc.)
βββ IBlock.cs, JBlock.cs... # Definitions for each tetromino
βββ Position.cs # Simple row/column helper class
βββ MainWindow.xaml/.cs # UI & game loop
βββ README.md # This file
- Windows OS
- Visual Studio (2022+ recommended)
- .NET Desktop Development workload
- Clone the repo:
git clone https://github.com/ndrada/Tetris.git- Open the
.slnfile in Visual Studio - Hit Run (F5) to start playing!
No additional packages or setup needed.
- Score increases by number of cleared rows
- Game ends when new block can't spawn
- You can rotate CW/CCW, move side to side, and hard-drop
- Hold a piece to save for later (one-time per drop)
- Implemented OOP principles through abstract classes & inheritance
- Built logic-heavy systems like block collisions, rotations, and queue shuffling
- Gained confidence in WPF rendering and UI threading
- Add sound effects
- Implement ghost preview of where block will land
- Add level progression with increasing speed
- High score tracking
Built by yours truly to level up my C# and game dev skills. Feel free to fork it, try it, or reach out if you want to roast my game logic haha.
Thanks for checking it out! β¨