如何判断两个部分是否在某一侧发生碰撞? (例如rect1.rect.top,rect2.rect.bottom)我试过 rect1.rect.colliderect(rect2) 和 pygame.sprite.collide_rect(rect1, rect2) ,但他们没有找到单独的侧面碰撞 .
rect1.rect.colliderect(rect2)
pygame.sprite.collide_rect(rect1, rect2)
没关系,我找到了答案 . if rect1.rect.bottom >= rect2.rect.top and rect1.rect.bottom <= rect2.rect.bottom:
if rect1.rect.bottom >= rect2.rect.top and rect1.rect.bottom <= rect2.rect.bottom:
1 回答
没关系,我找到了答案 .
if rect1.rect.bottom >= rect2.rect.top and rect1.rect.bottom <= rect2.rect.bottom: