Quote:
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.
Quote:
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
Quote:
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.
Quote:
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;
if (ball.x >= paddle.x && ball.x <= paddle.x + paddle.width)
ball.dx = (ball.x - paddle.x) / (paddle.width / 2 / maxdx);
I'm not sure if that was what you were looking for, but I hope it helps.