Processing Forum
hello,
I'm making a game similar to pong game. i let some balls moving inside window and i put a bar at the bottom of the window. i can control the bar to move left and right to hit the balls so that they can go up and go back again when they hit the top edge of the window.
my problem is after the balls hit by the bar, the ball don't bounce back when they hit the edges of window and go away.
i guess the problem is when hit is true, the direction of the speed is changed but not change back when they hit the edges. like below.
if(hit){
ball[i].xspeed*=-1;
ball[i].yspeed*=-1;
}
do anyone know how to fix the problem? thank you first.