How do you assign a “rect” attribute to a pygame.sprite.rect rectangle in Pygame?
问题 This question has been asked before, but the code they answer doesn't apply to me. I want to check when two rectangles collide in my game, and for the circle, I put a rectangle behind the circle(it's colored black). However, when I run, I get an error saying the rectangle needs to have a rect attribute. Here is my code: clock = pygame.time.Clock() pygame.init() change = False screen = pygame.display.set_mode((400, 300)) done = False x = 100 y = 30 bound = False while not done: for event in