我在pygame中制作了一个简单的自动卷轴程序,但是pygame.sprite.spritecollide不起作用。它没有显示任何错误,恐龙忽略了障碍。
for i in range(numberblocks):
block = obstacle(GRAY, random.randint(15, 30), 20)
block.rect.x = random.randrange(1000, 40000)
block.rect.y = 500
obstacle_list.add(block)
(Main Loop):
blocks_hit_list = pygame.sprite.spritecollide(dino, obstacle_list, True)
for block in blocks_hit_list:
score += 1