4
\$\begingroup\$

I am building a Pong clone to learn interactive programming and I've stumbled in getting the ball movement and bouncing on the paddles right.

If I play the original game I can't really understand how the "spin" and the paddle bounce works.

I've been searching a bit on the internet and all I got was just more confusion.

Can anybody explain me how the bounce is handled? If the paddle stands perfectly still and the ball, just moving on x, hits the paddle at the center I simply get -x, that is clear.

What happens if you hit the paddle on the sides? What changes if when the ball hits the paddle the paddle is also moving?

I did an Arkanoid-like implementation but it is far from the real Pong feeling.

\$\endgroup\$
2
\$\begingroup\$

What i understand in the pong implementation (or other brick breackers) is that the most you hit the side of the paddle the more the ball will go in that direction.

Here is a small picture of what i mean:

enter image description here

So you just have to calculate the center of the paddle then you calculate the ration from the side of it and determine the angle from that ratio. I do not think that they use the speed of the paddle to compute the angle.

Tell me if i am clear enough i can improve the answer little bit.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hi Ludovic and thanks for your great contribution... Did you try playing the game recently? (Original Pong) \$\endgroup\$ – Pitto Aug 30 '17 at 15:02
  • \$\begingroup\$ @Pitto Not recently but i already thought about how they implemented it and for every one i tried the speed of the paddle did nothing \$\endgroup\$ – Ludovic Feltz Aug 30 '17 at 15:08
  • \$\begingroup\$ Simply great, Ludovic: thank for your kind help :) \$\endgroup\$ – Pitto Aug 31 '17 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.