I am making a pong game in sdl.
So how i can check if the ball is hited in the center or in the lefft-right side so to the correct direction?
Just change the ball's x velocity based on how far from the center of the paddle it lands.
Ball.vy *= -1;
Ball.vx += (Ball.x - Paddle.x) * Modifier;
Or, if you use the left or right side of the paddle as its position:
Ball.vx += (Ball.x - Paddle.x -/+ Paddle.length/2) * Modifier;
Last edited on
can add me in skype to help me?
Because i did not understand.?
my skype is hepic.hepic
add me and after delete me if you want.
Topic archived. No new replies allowed.