Skip to content

This repository contains my C++ project on classic ping-pong game

Notifications You must be signed in to change notification settings

Drob1007/Ping-Pong-on-CPP

Repository files navigation

Ping Pong Game on C++

This repository contains my project on a classic Ping Pong game made on C++. This is my first C++ project and I have tried my best to simulate the game.

Ping Pong happens to be a very popular video game since the dawn of video games.

This game takes a console input/output based approach on displaying objects and controlling the game.

How to play:

  1. Clone the repository and open the directory
  2. Run main.exe

Game Controls:

  • I Key - to move right blade up.
  • K Key - to move right blade down.
  • W Key - to move left blade down.
  • S Key - to move left blade down.

Files Description:

  • main.cpp - contains the source code (thoroughly explained through comments)
  • main.o - object code
  • main.exe - executable file for game

Libraries Used:

  • iostream - for outputting to screen (cout).
  • conio.h - for listening for keys pressed.
  • ctime - for generating random number seed.
  • cstdlib - for generating random numbers.

Code Description: - Details of code are thoruoughly described in comments with the code itself.

Classes:

  • Ball - to store position of ball.
  • Blade - to store position of blades.
  • Game - to display the ball and blade and implement the logic.

Functions:

  • int main() - main activity handler - to run the game loops.

Thanks for viewing my project.

This project taught me many basic coding skill. The biggest challenge with the project was to make the ball move. This part of code required lot of efforts figuring out the geometry of grid.

Hope you like the efforts.

Here's a snapshot of the game: alt text

Thank You. :)

About

This repository contains my C++ project on classic ping-pong game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages