I am using pygame, python3.9, I want to make to return which side(rect1) is collided with rect2. I've already tried this but it dosen't work. I just want internal module and pygame.(sorry for bad english)
def side(rect1, rect2):
direction = ""
if rect1.midtop[1] > rect2.midtop[1]:
direction = "top"
if rect1.midleft[0] > rect2.midleft[0]:
direction = "left"
if rect1.midright[0] < rect2.midright[0]:
direction = "right"
if rect1.midbottom[1] < rect2.midbottom[1]:
direction = "bottom"
return direction