- import sys
import pygame
from settings import Settings
from ship import Ship
class AlienInvasion:
def __init__(self):
pygame.init()
self.settings = Settings()
self.screen =pygame.display.set_mode((self.settings.screen_width,self.settings.screen_hight))
pygame.display.set_caption("Alien Invasion")
def run_game(self):
self.screen.fill(self.settings.bg_color)
pygame.display.flip()
if name == 'main':
ai = AlienInvasion()
ai.run_game()
def __init__(self):
pygame.display.set_caption("Alien Invasion")
self.ship = Ship(self)
self.bg_color = (230,230,230)
def run_game(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
self.screen.fill(self.bg_color)
self.ship.blitme()
pygame.display.flip()
-