我是pygame [和整个python]的新手,我最近一直在玩精灵和碰撞,目前我不确定你是否可以检查一个sprite的碰撞到另一个,而不只是检查两个相交的精灵。
是否可以通过pygame检查移动/碰撞到另一个精灵的精灵?
编辑:下面是碰撞代码,只检查两个我不想要的精灵相交,因为我无法指定哪一个打到另一个
collision = pygame.sprite.collide_rect(player1, player2)
if collision == True:
group1.remove(player1, player2)
pygame.display.set_caption("They destroyed eachother! Press space to retry")
player1.rect.x = 5
player1.rect.y = 5
player2.rect.x = 445
player2.rect.y = 445
startanew = True
if startanew == True and keys[pygame.K_SPACE]:
group1.add(player1, player2)
pygame.display.set_caption("Squares Fight!")