Can you please advise me on where my mistakes are in this code?
I’ve only been coding for about a month.
It’s telling me that I made two mistakes.
Please let me know specifically how to fix them:
#Overall class to manage game assets and behavior.
def __init_(self): #Initialize the game, and create game resources. pygame.init() self.screen = pygame.display.set_mode((1200, 800)) pygame.display.set_caption("Alien Invasion") def run_game(self): #Start the main loop for the game. while True: #watch for keyboard and mouse events. for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() #Make the most recently drawn screen visible. pygame.display.flip()
if name == “main”:
#Make a game instance, and run the game.
ai = AlienInvasion()
Traceback (most recent call last):
File “C:/Users/qzhon/AppData/Local/Programs/Python/Python37/Python_Josh/Alien_game.py”, line 31, in
File “C:/Users/qzhon/AppData/Local/Programs/Python/Python37/Python_Josh/Alien_game.py”, line 20, in run_game
for event in pygame.event.get():
pygame.error: video system not initialized
Thank you very much,