Hi,
you gave this code,
else if (Collision::PixelPerfectTest(ball, paddle.getShape()))
{
if (!ball.getGlobalBounds().contains(paddle.getShape().getPosition().x, paddle.getShape().getPosition().y))
{
y_ballSpeed = -y_ballSpeed;
}
}
maybe if you add to the condition that the ball is going to the bottom of the screen, like this
if (!ball.getGlobalBounds().contains(paddle.getShape().getPosition().x, paddle.getShape().getPosition().y)
&& y_ballSpeed > 0
)
to avoid the issue Hapax wrote about ... otherwise, when the ball hits the paddle on its very very edge, as the ball´s Y comes very low, the original condition would be true more than once, making the sentence:
y_ballSpeed = -y_ballSpeed;
execute a few times and getting a wrong behaviour of the ball
but if the condition requests the ball leading to the bottom, there won´t be a 2nd execution of that sentence because on the 2nd time the ball will be pointing to the screen top
Hope this helps