color = random.choice(["red", "white"]) pos = random.choice([0,1]) if pos == 0: x = bwidth + 12 elif pos == 1: x = bwidth + bar_gap - 12 ball = Ball(x, 10, 1, color, win) ball_group.add(ball) last_bar = next_bar for ball in ball_group: if ball.rect.colliderect(p): if ball.color == "white": ball.kill() coin_fx.play() score += 1 if score > high_score: high_score += 1 score_card.animate = True elif ball.color == "red": if not bird_dead: death_fx.play() destroy_bird() bird_dead = True bar_speed = 0 if pygame.sprite.spritecollide(p, bar_group, False): if not bird_dead: