Okay... I am now working on a simple game of Pong. Everything is going well - the paddling, the ball moving across the screen to the other paddle - but I can not get "score" to work... I have tried a "for" loop, but when I do, the window shows up, but so does a big list of exceptions.
~
The highlighted part is where I think the part that controls the score needs to go. All I'm needing is a simple score drawString command that will give each paddle a point after... well, you know how Pong works
.
Any ASAP help is greatly appreciated. Thanks SOOOOOO much.

~
Code:
public void paint(Graphics window)
{
ball.moveAndDraw(window); //move the ball and redraw it
leftPaddle.moveDownAndDraw(window);
leftPaddle.moveUpAndDraw(window);
rightPaddle.moveUpAndDraw(window);
rightPaddle.moveDownAndDraw(window);
int score = 0;
int score2 = 0;
//see if ball hits left wall or right wall
if ( ball.getX() > 550)
{
ball.setXSpeed(-ball.getXSpeed());
ball.setYSpeed(-ball.getYSpeed());
score = score + 1;
}
if(ball.getX()<10)
{
ball.setXSpeed(-ball.getXSpeed());
ball.setYSpeed(-ball.getYSpeed());
score2 = score2 +1;
}
//see if ball hits top wall or bottom wall
if ((ball.getY()>450) || (ball.getY()<50))
{
ball.setYSpeed(-ball.getYSpeed());
}
//see if ball hits left paddle
[B]if(didCollideLeft())
{
ball.setYSpeed(-ball.getYSpeed());
ball.setXSpeed(-ball.getXSpeed());
}
//see if Ball hits right paddle
if(didCollideRight())
{
ball.setYSpeed(-ball.getYSpeed());
ball.setXSpeed(-ball.getXSpeed());
}[/B]
//see if the paddles need to be moved
The highlighted part is where I think the part that controls the score needs to go. All I'm needing is a simple score drawString command that will give each paddle a point after... well, you know how Pong works
Any ASAP help is greatly appreciated. Thanks SOOOOOO much.
