def notify(self, event): # go to the next slide if isinstance(event, ReturnEvent): self.time = 0 # skip all the slides elif isinstance(event, EscapeEvent): self.time = 0 self.is_finished = True # quit the game elif isinstance(event, SafeExitEvent): safe_exit()
def notify(self, event): # go to the next slide if isinstance(event, ReturnEvent): self.time = 0 # skip the intro elif isinstance(event, EscapeEvent): self.time = 0 self.is_finished = True # quit the game using safe exit elif isinstance(event, SafeExitEvent): safe_exit()
def do_actions(self): safe_exit()
def _quit_option(self): if self.game_opts.verbose: print 'Exit the game!' # perform safe exit safe_exit()
def _quit_option(self): if self.game_opts.verbose: print('Exit the game!') # perform safe exit safe_exit()
def __call__(self, parser, namespace, values, option_string=None): for line in LICENSE: print(line) safe_exit()
def run(self): # perform cutscene slides main process for slide in self.slides: # while the alpha of the blank slide is not zero while self.alphavalue >= 0: # set the blank slide alternation delay self.clock.tick(80) # decrease alpha value self.alphavalue -= 5 # set the new alpha value of the blank slide self.blank.set_alpha(self.alphavalue) # blit the slide self.screen.blit(slide, (0, 0)) # blit the blank slide self.screen.blit(self.blank, (0, 0)) # display the screen surface pygame.display.update() # set the slides presence delay time = 100 # show the slide for some time while time >= 0: # delay for each time monad self.clock.tick(10) # blit the slide self.screen.blit(slide, (0, 0)) # display the screen surface pygame.display.update() # intro event loop for e in pygame.event.get(): if e.type == pygame.QUIT: # perform safe exit safe_exit() # handle keyboard keys key = pygame.key.get_pressed() # when user presses return key or space key if key[K_RETURN] or key[K_SPACE]: # force to go to the next slide time = 0 # decrease the time where a slide is showed time -= 1 # while the alpha of the blank slide is not zero while self.alphavalue <= 255: # set the blank slide alternation delay self.clock.tick(80) # decrease alpha value self.alphavalue += 5 # set the new alpha value of the blank slide self.blank.set_alpha(self.alphavalue) # blit the slide self.screen.blit(slide, (0, 0)) # blit the blank slide self.screen.blit(self.blank, (0, 0)) # display the screen surface pygame.display.update() # the scene is finished self.is_finished = True