0

I am creating a Flappy Bird clone to learn pygame based on a video tutorial. At this stage, the script is supposed to display a 800x400 window, fill it with black, and overlay an image.

However, when running the script, the window remains white -- it does not fill it with black or overlay the image.

Below is my code:

import pygame


black = (0,0,0)
white = (255,255,255)

pygame.init()
surface = pygame.display.set_mode((800, 400))
pygame.display.set_caption('Helicopter')
clock = pygame.time.Clock()


def helicopter(x, y, image):
    surface.blit(image, (x, y))


img = pygame.image.load('helicopter.png')
x = 150
y = 200

game_over = False

while not game_over:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            game_over = True

    surface.fill(black)
    helicopter(x, y, img)

    pygame.display.update()
    clock.tick(60)

pygame.quit()
quit()

I have verified that both surface.fill(black) executes and that helicopter() is called.

How do I fix this?

I am using pygame 1.9.6 with python 3.7.3 on macOS 10.14.3.

Josh
  • 1,357
  • 2
  • 23
  • 45
  • 2
    This might be an issue with your particular setup. Try running `python3 -m pygame.examples.aliens`. Edit: it's a [bug](https://github.com/pygame/pygame/issues/555) – dg-vwp May 27 '19 at 05:45
  • Thanks, it is a bug. `python3 -m pygame.examples.aliens` gave me the same issue. – Josh May 28 '19 at 02:00

0 Answers0