示例#1
0
    #draw ground
    pygame.draw.rect(gameDisplay, brown, [
        0, screen.height - obstacle.ground_height, screen.width,
        obstacle.ground_height
    ])

    #draw bird
    gameDisplay.blit(bird.curr, (bird.x_axis, bird.y_axis))

    score_label = score_font.render('score:' + str(score), 1, black)
    gameDisplay.blit(score_label, (0, 0))
    pygame.display.update()

    if game_over:
        play_sound(punch)
        obstacle.x_axis = screen.width
        bird.y_axis = (screen.height / 2) - (bird.height / 2)
        final_score = score
        score = 0
        score_flag = False

    clock.tick(FPS)

    #Game Over Screen Loop
    while game_over:
        if final_score > high_score:
            high_score = final_score
        gameDisplay.fill(red)
        score_label = score_font.render('score:' + str(final_score), 1, black)
        gameDisplay.blit(score_label, (10, 0))
        high_score_label = score_font.render('high score: ' + str(high_score),