0
I’m making a game, like Arkanoid. The physics of collision between objects and the screen are great.
The "colliderect(rect)" method works, but when the ball hits the batter’s sides, the ball instead of coming back, it bends into the batter, causing the coordinates of y to alternate between positive and negative until the ball exits from inside the batter.
This is the method:
def get_paddle_collision(self, paddle):
"""It makes the necessary operations according to the collision."""
if self.rect.colliderect(paddle.rect):
self.yspeed *= -1
I tried to implement it as a screen collision, but it didn’t work out. I’ll be grateful to anyone who can help.