Example #1
0
    def __init__(self):
        """Initialize the game, and create game resources."""
        pygame.init()
        self.settings = Settings()

        self.screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
        self.settings.screen_width = self.screen.get_rect().width
        self.settings.screen_height = self.screen.get_rect().height
        pygame.display.set_caption("Alien Invasion")

        # Create an instance to store game statistics and a scoreboard
        self.stats = GameStats(self)
        self.sb = Scoreboard(self)

        self.ship = Ship(self)
        self.bullets = pygame.sprite.Group()
        self.aliens = pygame.sprite.Group()
        self.sound_effects = SoundEffects()

        self._create_fleet()

        # Make the play buttons -- TO REFACTOR.
        self.play_button = Button(self, (0, 255, 0), 200, 50)
        self.hard_button = Button(self, (0, 0, 255), 100, 50)
        self.crazy_button = Button(self, (255, 0, 0), 100, 50)
from sound_effects import SoundEffects

effects = SoundEffects()
loc = '../sounds/Yee.wav'
effects.play_wave_file(loc)
effects.play_wave_file(loc)