Simple C++ Tetris Game Project

CPPND: Capstone Simple Tetris Game Repo

This is a Simple Tetris Game Repo for the Capstone project in the Udacity C++ Nanodegree Program.
This project structure is inherited from The empty starter Github repositry.
And Simple Tetris Game is inherited from CppND-Capstone-Tetris-Game.

My solution: Github Repo.

With adding some features as follow:

  • Move all config for screen to main.cpp.
  • Fix code to show window title ans close button, also display score and FPS.
  • Move handle input evens to Controller class (Added Controller class).
  • Move render business to Render class (Added Render class).
  • Add score log when terminate the game.

Here is image captured from the game:

Game Demo

Dependencies for Running Locally

Basic Build Instructions

  1. Clone this repo

    1
    git clone git@github.com:KhoiVuKha/CppND-Capstone-Simple-Tetris-Game.git
  2. Make a build directory in the top level directory:

    1
    mkdir build && cd build
  3. Compile:

    1
    cmake .. && make
  4. Run it:

    1
    ./SimpleTetrisGame

How to play

  • Player should place the falling tetrominos in a way that the Well has as less as possible empty cells.
  • When line in the Well has no empty cells, it is deleted.
  • Player can rotate tetrominos, accelerate their fall.
  • Player fails, when at least one figure exaggerates the game field on the top.
  • For one deleted line player receives 100 scores.

Controll the game by some key evens:

  • Left arrow - move the tetromino left.
  • Right arrow - move the tetromino right.
  • Down - move the tetromino down.
  • Space - Rotate the tetromino.

Project structure

The Simple Tetris game code consists of five main classes: Game, Tetromino, Well, Controller, and Renderer.

  • To begin, main creates a Controller, a Game, and a Renderer object. Game stores a Tetromino and Well object as part of the state.
  • main calls Game::Run to start the game loop.

Here is project structure:

Project Structure

Author

Khoi Vu

Posted on

2024-09-14

Updated on

2024-09-18

Licensed under

Comments