| 140 | |
| 141 | |
| 142 | def load_images(): |
| 143 | def load_image(img_file_name): |
| 144 | file_name = os.path.join(".", "images", img_file_name) |
| 145 | img = pygame.image.load(file_name) |
| 146 | img.convert() |
| 147 | return img |
| 148 | |
| 149 | return { |
| 150 | "background": load_image("background.png"), |
| 151 | "pipe-end": load_image("pipe_end.png"), |
| 152 | "pipe-body": load_image("pipe_body.png"), |
| 153 | # images for animating the flapping bird -- animated GIFs are |
| 154 | # not supported in pygame |
| 155 | "bird-wingup": load_image("bird_wing_up.png"), |
| 156 | "bird-wingdown": load_image("bird_wing_down.png"), |
| 157 | } |
| 158 | |
| 159 | |
| 160 | def frames_to_msec(frames, fps=FPS): |