Tetrix game is created in C programming without using graphic library. We draw shapes only using # character and played on command window. User can play game using up, left, right, and down arrow key. The up key rotate Tetrimino (Shapes) in clockwise direction, left key move Tetrimino (Shapes) in left direction toward negative x-axis, right key move Tetrimino (Shapes) in right direction toward positive x-axis, and down key rotate Tetrimino (Shapes) in anticlockwise direction. By default, Tetrimino (Shapes) will move 1 unit downward toward negative y-axis in each frame of the game. The score is calculated based on the number of rows filled with boxes.
The main objective of this project is to provide knowledge and technique about creating Tetris game in C programming, provide basic knowledge of linear algebra used to rotate and translate shapes. User can use any graphics library to draw window, and shapes to make it similar to commercial games. However, the algorithm of the game is same in all Tetris game available in market.
In this article, I will explain the following items:
- Coordinate system of the game
- Usage of linear algebra to rotate and translate shapes.
- Data Structure used in the game
- Collision detection and score checking Techniques
Also, Download the final version of the game Download Project from GitHub.
I have explained the game in following two articles:
Part 1: Tetriminos (Shapes), Coordinate System, Rotation and Translate
Part 2: Data Structure, Collision detection and Score checking Techniques