예제 #1
0
                next_level = False

    # part 1.6b: Give the screen a background color.
    screen.fill(WHITE)
    
    # part 2.6a: Get the position of the mouse.
    pos = pygame.mouse.get_pos
    
    # part 2.6b: The rect attribute of your RunnerSprites class also has its own attributes.
    # They can be used to set the position of any instance of that class.
    # Since your player is an instance of the RunnerSprites class we can use its rect attribute to set its position.
    # You can find out about the attributes of the rect attribute here. (Be sure to check out the x, y, midright and center attributes).
    # part 2.6c: Set the position of your player to the position of the mouse you got earlier.
    
    player.rect.x = pos[0]
    player.rect.y = pos[1]
    
    # part 1.6c: Using the instances of the Scroller class you created earlier draw the buildings to the screen and move the buildings.
    any_scroller.draw_buildings(screen)
    any_scroller.move_buildings()
    
    # part 2.6d: BELOW the code that draws the scrolling background call the draw method on your all_sprites_list passing in the global screen variable.
    all_sprites_list.draw(screen)
    
    # part 1.5c: Make sure to include the code that flips screen and the code that controls how many times the clock ticks.
    pygame.display.flip()
    clock.tick(60)

# part 1.5d:After the loop make sure to write pygame.quit() and then exit()
pygame.quit()
exit()