Skip to content

A classic game of Tetris created with C++ using the OOPs concept and RayLib library.

Notifications You must be signed in to change notification settings

sumraharshit/Tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tetris

Tetris is a puzzle video game in which falling tetrominoes are manipulated, with help of user input to form complete rows. The main aim of doing this project was to practise and improve OOPs implementation.The readme of the classic game of Tetris created with C++ using the OOPs concept and RayLib library consists of information about how to run the code on your system, bug fixes, updates, etc.

How to run the code

You need to install raylib library on your system. RayLib is an open source library favourably used for creating video game.
It can downloaded by using the link Download

The files have been included for smooth execution, so you just need to download zip from repository and Raylib Library, open the folder in IDE and run the main.cpp file.
If you are interested in knowing the whole process, you can go thorugh the link here

Work Flow

In a specified grid, a random block among 7 different blocks moves down after a time interval using event trigger. The block can be manipulated by following user inputs.
User Inputs
Up Arrow: To rotate the block. Each block has 4 different rotation states.
Down Arrow: To move the block down.
Right Arrow: To move the block right.
Left Arrow: To move the block left.

As the block touches the bottom of the screen(grid) or collides with other blocks it gets locked in that position. The code prevents the block to move out of grid or to overlap the other blocks. The program checks from bottom to top, whether any row has been completely filled or not. If it is, then the filled row is cleared and the partially filed rows are moved down.

The comments have been added in the code files for better understanding.

About

A classic game of Tetris created with C++ using the OOPs concept and RayLib library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published