magopian/elm-pong

Round the paddle angle

Natim opened this issue · 3 comments

Natim commented

With the current condition, the contact is made between the center of the ball and a point of the pad.

However, sometime, the center doesn't hit the pad but the ball does.
Especially in the angle.

We could:

  • Change the condition to handle this case
  • Round the pad so that this case doesn't happens anymore.
Natim commented

image

I was thinking about dealing with this in the 4th blog post: in the original pong

  • the ball is a square, so the hitbox is simpler to check
  • the paddle bounces the ball with an angle: the closer to the edge the ball gets, the bigger the angle (see The Ball <-> Racket Collision Angle)

This is now fixed in 869c359

Thanks @Natim !