示例#1
0
        if hits == 4 or hits == 12:
            ball.increase_speed()

    # detect paddle miss
    if ball.ycor() < -300:
        lives -= 1
        scoreboard.lost()
        ball.reset()
        hits = 0
        red_contact_first_time = False
        orange_contact_first_time = False

    # detect paddle collision with yellow blocks
    for block in blocks.list_of_yellow_blocks:
        if ball.distance(block) < 40:
            blocks.remove(blocks.list_of_yellow_blocks, block)
            ball.bounce_y()
            scoreboard.yellow_point()

    # detect paddle collision with green blocks
    for block in blocks.list_of_green_blocks:
        if ball.distance(block) < 40:
            blocks.remove(blocks.list_of_green_blocks, block)
            ball.bounce_y()
            scoreboard.green_point()

    # detect paddle collision with orange blocks
    for block in blocks.list_of_orange_blocks:
        if ball.distance(block) < 40:
            blocks.remove(blocks.list_of_orange_blocks, block)
            ball.bounce_y()