diff --git a/alien_invasion.py b/alien_invasion.py index 159b37b..7d8588d 100644 --- a/alien_invasion.py +++ b/alien_invasion.py @@ -2,14 +2,17 @@ import sys import pygame +from settings import Settings + class AlienInvasion: """Overall class to manage game assets and behaviour.""" def __init__(self): """Intialize the game, and create game resources""" pygame.init() + self.settings = Settings() - self.screen = pygame.display.set_mode((1200, 800)) + self.screen = pygame.display.set_mode((self.settings.screen_witdh, self.settings.screen_heigh)) pygame.display.set.caption("Alien Invasion") # Set the background color. @@ -24,7 +27,7 @@ class AlienInvasion: sys.exit() # Redraw the screen during each pass through the loop. - self.screen.fill(self.bg_color) + self.screen.fill(self.settings.bg_color) # Make the most recently drawn screen visible. pygame.display.flip() diff --git a/images/ship.bmp b/images/ship.bmp new file mode 100644 index 0000000..9a94402 Binary files /dev/null and b/images/ship.bmp differ diff --git a/settings.py b/settings.py index 02389e6..eac204d 100644 --- a/settings.py +++ b/settings.py @@ -1,2 +1,9 @@ class Settings: """A class to store all settings for alien invasion.""" + + def __init__(self): + """Initialize the game's settings.""" + # Screen settings + self.screen_witdh = 1200 + self.screen_heigh = 800 + self.bg_color =(230, 230, 230) \ No newline at end of file