1. ## pong

I need alot of help on my very simple pong clone that I am creating using the Windows API.

How do I give the paddles limited movement? I want it limited between the players stats and the bottom.

How do I stop the ball from disappearing off into the bottom and right side of the playing field?

What type of AI would pong use?

The ball bounces at a 45 degree angle. Is that the type of psyhics that pong uses?

Thank you

2. How do I give the paddles limited movement? I want it limited between the players stats and the bottom.
Before you do keyboard input, store paddle x,y into temp vars, then after you do the keyboard input, determine a minx, miny, maxx, maxy with your values for player stats and the bottom. If the paddle has exceeded minx or maxx, set paddle.x to the pre-movement value, same for y.

How do I stop the ball from disappearing off into the bottom and right side of the playing field?
Since you're using dx and dy this is easy,
Code:
```if (ball.x < ball.radius || ball.x > the width of the screen - ball.radius)
ball.x *= -1;```
once again, repeat for y

What type of AI would pong use?
I don't know about everybody else, but I like to limit the possible values of dx somehow (like with the deflection from the paddles, see below), then make the ai paddle move a little bit slower than that.

The ball bounces at a 45 degree angle. Is that the type of psyhics that pong uses?
Once again, I can't speak for everybody, but I like to build this with two parts: First, put in collisions on the "walls" (the sides that don't have paddles) that just multiply d-whatever by -1 to make the ball bounce off (see above). Second, I like to put in code to make it that so the ball's speed between the paddle-sides is determined by where it hits the paddle, something like this:
Code:
```const int maxdx = 4;