Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Here's what I have so Far:

C++
#include <stdio.h>

int main(void) {
  // Pong Game, Febuary 10
  int ball;
  printf("Hello\n");
  printf("This game will play a game of pong\n");
  printf("Pong is simple. You control a board, a AI controls another, on the oppisite side. You bounce a ball back and forth, each trying to defend your side, while trying to push it in the other's side\n");
  printf("Let's get started!\n");
  if 
  {


  }

  return 0;
}


What I have tried:

Everything Please help me I need to do this
Posted
Updated 10-Feb-21 7:14am
v2
Comments
jeron1 10-Feb-21 13:36pm    
"You control a board, a AI controls another"
AI? Are you trying to launch an existing program or are you wanting to write your own?

 
Share this answer
 
v2
If this is as far as you can go, you need to research various topics. For one thing, you'll need to do simple graphics--maybe just two paddles, a ball, and the score. The user will control the vertical movement of one paddle with an input device, and your program will control the other. If a ball comes in at angle X above/below horizontal, it goes out at angle X below/above horizontal. You will need a timing loop to display the position of the ball, and you'll need to determine whether it intersected a paddle when it reaches the edge. Start by sketching the whole thing out in pseudo-code, even using plain English. Then start researching the parts that you don't know how to do, like waking up at fixed intervals to update the position of the paddles and ball, read the position of a mouse or other device, update the display, and so on. Note that C/C++ provides no graphics capability. For that, you'll have to look into whatever is provided by the system you're running on (Windows, for example).

EDIT: Now I see that Mr. Zeeland has kindly provided a link to a C++ library that supports graphics. That should help you with some of what you need to do.
 
Share this answer
 
v3
Comments
RickZeeland 10-Feb-21 14:27pm    
Ah, Mr.Zeeland, like the sound of that :)
But I think you were correct that C basically does not have graphics capabilites, you need extra libraries for that, and there are lots of them.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900