Hi
I wanted to make the classic pong game in 2D before trying something else, its a classic game and deserves to be made first above others.
Anyway, i have loaded the sprites i.e.computer paddle, player paddle and the ball. i can move the paddle using the left and right arrow keys and i can make the ball move. i can also make the computer paddle follow the ball i.e.
if ballx > computerpaddlex then computerpaddlex += computerspeed
else
computerpaddlex += -computerspeed
the problem that i am now faced with is that i cant seem to make the ball bounce of the wall.
i know the theory as i have done it before but it just isnt working.
the theory is that if the ball hits a vertical wall then reverse x and if it hits a horizontal wall then reverse y but it dosent work.
if ballx > rightwall then bally = -bally
can someone help me out
thanks