Flappy Bird – Moving

STEP Four – A

— Add this after the pygame.event.get code block and before the  displaying the bird

#Moving the Bird up and Down
        #  if a key is pressed 
        if event.type == pygame.KEYDOWN:
            # if the key is a space
            if event.key == pygame.K_SPACE:
                #  set y_change to -6
                bird_y_change = -6
         
        #- If Key Released == Space Move Bird Down
        #  if a key is released
        if event.type == pygame. KEYUP :
            # if the key is a space
            if event.key == pygame.K_SPACE:
                #  set y_change to 3
                bird_y_change = 3
     
    #- Move the Bird
    # moving the bird vertically
    bird_y += bird_y_change
     
    #- Set Boundary Limits for the Bird
    # setting boundaries for the birds movement
    if bird_y <= 0:
        bird_y = 0
    if bird_y >= 571:
        bird_y = 571
 
##########################################################
##                                                      ##
##      Replace this with Code from Step FIVE-B         ##
##                                                      ##
##########################################################

STEP Four – B

— Add this after the display update

# - Slowing the Game Down
##########################################################
#    SLOW DOWN THE GAME - Change the value to suit 
    pygame.time.wait(15)
##########################################################

Step TWO

Run your code

You should get a screen that looks like this.

and you should be able to move your bird using the space bar