Learn how to program a Tetris game in C# using WPF.
Download the assets here:
[ Ссылка ]
Source code is available here:
[ Ссылка ]
In this video you will learn how to write a Tetris game in C# without any game engine. This video is a step-by-step guide, and contains everything you need to know to write a Tetris game. You will learn about the representation of the game grid and the blocks from animations and code. The code is written in C#, but the ideas and design of the game can also be used in other programming languages like Java and C++. Have fun learning about game development in C#!
Chapters
0:00 - Introduction
0:11 - Project Setup
0:45 - Game Grid Representation
2:00 - Writing a GameGrid class
4:13 - Clearing Rows
6:22 - The 7 Blocks
6:32 - Block Rotation
7:55 - Block Movement
8:34 - Adding a Position class
8:57 - Writing a Block class
10:58 - The IBlock
11:56 - The OBlock
12:33 - Block Data
12:53 - Picking the Next Block
14:15 - The GameState Class
17:59 - Importing Assets
19:04 - The UI
23:36 - Loading Assets
24:50 - Setting Up the Canvas
27:20 - Drawing the Game Grid
27:35 - Drawing the Current Block
27:53 - Drawing the Game State
28:22 - Detecting Key Presses
29:07 - The Game So Far
29:33 - Adding a Game Loop
30:17 - Handling Game Over
30:38 - Restarting the Game
31:04 - Fixing Spawn Position
31:46 - Making Last Block Visible
32:20 - Next Block Preview
32:51 - Score
33:49 - Hold Feature
35:34 - Hard Drop Feature
37:02 - Ghost Block
38:02 - Increasing Difficulty
38:59 - Adding an Icon
39:16 - Thanks!
![](https://s2.save4k.ru/pic/jcUctrLC-7M/maxresdefault.jpg)