Flappy Bird – Collisions

STEP Six – A
— Add this between declaring the display obstacles function and setting running = True

# COLLISION DETECTION
def collision_detection (obstacle_x, obstacle_height, bird_y, bottom_obstacle_height):
    if obstacle_x >= 50 and obstacle_x <= (50 + 64):
        if bird_y <= obstacle_height or bird_y >= (bottom_obstacle_height - 64):
            return True
    return False
 
##########################################################
##                                                      ##
##      Replace this with Code from Step SEVEN-A        ##
##                                                      ##
##########################################################

STEP Six – B

— Add this between setting running = True and while running iteration

# waiting is going to refer to our end or start screen
waiting = True
# set collision to false in the beginning so that we only see the start screen in the beginning
collision = False

STEP Six – C

— Add this between moving the obstacle and generating new obstacles.

# COLLISION
    collision = collision_detection(obstacle_x, OBSTACLE_HEIGHT, bird_y, OBSTACLE_HEIGHT + 150)
  
    if collision:
#        # if a collision does occur we are gonna add that score to our list of scores and make waiting True
#        score_list.append(score)
        running = False