如何让 pygame.draw.rect 检测与 pygame.surface 的碰撞?

How do I make a pygame.draw.rect detect collision with a pygame.surface?

标题基本上说明了一切。这是 pygame.draw.rect:

的代码
stand = pygame.draw.rect(screen, green, (spike_x + 900, 400 - player_y + 476, 500, 500), border_radius=15)

我希望 stand 能够与玩家发生碰撞。玩家使用的是矩形碰撞盒:

player_collision = player.get_rect(topleft=(player_x, player_y))

我尝试使用 if player_collsion.collidepoint(stand):,但它不起作用。当我尝试这样做时,它显示 TypeError: argument must contain two numbers

你必须使用 colliderect() rather than collidepoint()collidepoint用于比较一个矩形和一个点,colliderect用于比较2个矩形:

if player_collsion.collidepoint(stand):

if player_collsion.colliderect(stand):