新手請教,遊戲入門程式 c

FeiGor發表於2019-11-12
import sys
import pygame

def run_game():
    pygame.init()
    screen = pygame.display.set_mode((1200, 800))
    pygame.display.set_caption("Alien Invasion")

    while True:
        for event in pygame.event.get():
            if event.type == pygame.quit():
                sys.exit()

        screen.fill((200, 200, 200))
        pygame.display.flip()

這段程式碼執行結果是這樣,請問什麼問題啊?照著書本的範例寫的。
Traceback (most recent call last):
  File "E:/My doc/Python/excersize/newgame/alien_invasion.py", line 36, in 
    run_game()
  File "E:/My doc/Python/excersize/newgame/alien_invasion.py", line 15, in run_game
    screen.fill((200, 200, 200))
pygame.error: display Surface quit

Process finished with exit code 1

相關文章