STEP Five – A
— Add this between declaring the bird variables and setting running = True
#Declare the Obstacle Variables
# OBSTACLES
OBSTACLE_WIDTH = 70
OBSTACLE_HEIGHT = random.randint(150,450)
OBSTACLE_COLOR = (211, 253, 117)
OBSTACE_X_CHANGE = -4
obstacle_x = 500
# Declare the Display Obstacle Function
def display_obstacle(height):
pygame.draw.rect(SCREEN, OBSTACLE_COLOR, (obstacle_x,0,OBSTACLE_WIDTH, height))
bottom_obstacle_height = 635 - height - 150
pygame.draw.rect(SCREEN, OBSTACLE_COLOR,(obstacle_x,height+150, OBSTACLE_WIDTH, 635-height-150))
##########################################################
## ##
## Replace this with Code from Step SIX-A ##
## ##
##########################################################
STEP Five – B
— Add this between setting the Boundaries for the bird and displaying the bird
# Moving the obstacle
obstacle_x += OBSTACE_X_CHANGE
##########################################################
## ##
## Replace this with Code from Step SIX-C ##
## ##
##########################################################
# generating new obstacles
if obstacle_x <= -10:
obstacle_x = 500
OBSTACLE_HEIGHT = random.randint(150, 400)
##########################################################
## ##
## Replace this with Code from Step SEVEN-C ##
## ##
##########################################################
# displaying the obstacle
display_obstacle(OBSTACLE_HEIGHT)