def game_loop(self): """ actual game loop """ # level creation levels = [ Level_01(self.screen, self.cfg['game']['screen_size'], self.mic), Level_02(self.screen, self.cfg['game']['screen_size'], self.mic) ] # choose level level = levels[0] # game logic with dependencies game_logic = ThingsGameLogic(level, levels) # add clock clock = pygame.time.Clock() # init stream self.mic.init_stream() # mic stream and update with self.mic.stream: # game loop while game_logic.run_loop: for event in pygame.event.get(): # input handling game_logic.event_update(event) level.event_update(event) # frame update level = game_logic.update() level.update() self.screen_capturer.update() # update display pygame.display.flip() # reduce framerate clock.tick(cfg['game']['fps']) # save video plus audio self.screen_capturer.save_video(self.mic)
screen_capturer = ScreenCapturer(screen, cfg['game']) # text #text = Text(screen) # level creation levels = [ Level_01(screen, cfg['game']['screen_size'], mic), Level_02(screen, cfg['game']['screen_size'], mic) ] # choose level level = levels[0] # game logic with dependencies game_logic = ThingsGameLogic(level, levels) # add clock clock = pygame.time.Clock() # init stream mic.init_stream() # mic stream and update with mic.stream: # game loop while game_logic.run_loop: for event in pygame.event.get(): # input handling