вот код столкновения (строка 144)
Код: Выделить всё
if myrect.colliderect(ballrect) and ball.killcooldown < 1:
cbot = abs(myrect.bottom - ballrect.top) #collision on the bottom of the brick
ctop = abs(myrect.top - ballrect.bottom) #collision on top
cright = abs(myrect.right - ballrect.left) #collision on the right
cleft = abs(myrect.left - ballrect.right) #collision on the left
cy = min(ctop,cbot)
cx = min(cleft,cright)
if cy < cx:
ball.vel[1]*=-1 #flip y speed
else:
ball.vel[0]*=-1 #flip x speed
self.alive = False
ball.killcooldown = 2
Мобильная версия