def play_screen(self): Sounds.play_music(Sounds.INTRO) self.screen.blit(self.surfaces['background'], (0, 0)) play_button = self.screen.blit(self.surfaces['play_button'], s.PLAY_BUTTON) quit_button = self.screen.blit(self.surfaces['quit_button'], s.QUIT_BUTTON_TITLE) while not self.finished: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: if quit_button.collidepoint(pygame.mouse.get_pos()): pygame.quit() quit() elif play_button.collidepoint(pygame.mouse.get_pos()): pygame.mouse.set_visible(False) Sounds.stop_music() self.finished = True # Keyboard events: elif event.type is pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() quit() # Toggle full screen with 'f' key: elif event.key == pygame.K_f: self._toggle_full_screen() # Toggle sound effects: elif event.key == pygame.K_n: if Sounds.get_se_volume() == 0: Sounds.set_se_volume(self.volume) else: Sounds.set_se_volume(0) # Toggle music: elif event.key == pygame.K_m: if Sounds.get_music_volume() == 0: Sounds.set_music_volume(self.volume) else: Sounds.set_music_volume(0) # blit background self.screen.blit(self.surfaces['title'], s.TITLE_POS) self.screen.blit(self.surfaces['tower'], s.TOWER_POS) self.screen.blit(self.surfaces['instructions'], s.INSTRUCTIONS_POS) pygame.display.update() self.clock.tick(s.FPS)