-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathresources.py
More file actions
32 lines (25 loc) · 1.09 KB
/
resources.py
File metadata and controls
32 lines (25 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""This file holds all images and sounds for the Flappy Bird game."""
from constants import *
import pygame
# Load images
# Here's some examples how images can be loaded using PyGame.
background_img = pygame.image.load("images/background.png")
pipe_img = pygame.image.load("images/pipe.png")
score_img = pygame.image.load("images/score.png")
logo_img = pygame.image.load("images/logo.png")
instructions_img = pygame.image.load("images/instructions.png")
# Now's your turn! Load the image for the bird (bird_img).
# Load sound effects
# Here's an example how sounds can be loaded using PyGame.
flap_sound = pygame.mixer.Sound("sounds/flap.wav")
# But our game needs more sounds! Add sound effects for:
# the bird colliding with the pipe (hurt_sound), and
# a score increase (point_sound).
# Scale images
background_img = pygame.transform.scale(background_img, (SCREEN_WIDTH, SCREEN_HEIGHT))
try:
bird_img = pygame.transform.scale(bird_img, (80, 80))
except NameError:
pass
pipe_img = pygame.transform.scale(pipe_img, (80, 800))
score_img = pygame.transform.scale(score_img, (SCREEN_WIDTH, SCREEN_HEIGHT))