Example #1
0
    def runing_game(self):
        """runing_game(self) start playing"""
        game_runing = True
        while game_runing:
            # start story screen
            story_pass = storyI.mainrun(functions.get_screen_set(), self.game_lvl, self.g_score)
            if story_pass:
                if story_pass == "exit":
                    game_runing = False
                    return "exit"
                if story_pass == "menu":
                    self.set_zero()
                    # setupI.mainrun()
                    return 0
                else:
                    # start play screen
                    game_pass = runI.mainrun(
                        functions.get_screen_set(), self.game_lvl, self.balls_pos, self.g_time, self.g_score
                    )
                    #                    game_pass = runI.mainrun(functions.get_screen_set(), \
                    #                    self.game_lvl, self.balls_pos, self.g_time, self.g_score)
                    self.g_time = 0
                    self.balls_pos = None
                    if game_pass["exit"]:
                        return "exit"
                    elif game_pass["loose"]:
                        g_res = "loose"
                        game_runing = False
                        self.g_score = game_pass["score"]
                    elif game_pass["wingame"]:
                        g_res = "wingame"
                        game_runing = False
                        self.g_score = game_pass["score"]
                    elif game_pass["winlvl"]:
                        self.game_lvl += 1
                        self.g_time = 0
                        functions.save_game(game_pass["score"], 0, self.game_lvl, None)
                        g_res = "winlvl"
                        self.g_score = game_pass["score"]
                    else:
                        if (game_pass["time"] > 0) or (self.game_lvl > 0):
                            functions.save_game(
                                game_pass["score"], game_pass["time"], self.game_lvl, game_pass["balls"]
                            )
                        self.set_zero()
                        return 0
                endI.mainrun(functions.get_screen_set(), g_res, self.g_score, self.g_time, self.game_lvl)
                if game_pass["loose"]:
                    if functions.set_check_rec([game_pass["score"], game_pass["time"]]):
                        recordI.mainrun(functions.get_screen_set(), game_pass["score"], game_pass["time"])

            else:
                game_runing = False
        # start "The End" screen

        sss = self.g_score

        self.set_zero()
        return sss
Example #2
0
 def mainrun(self):
     """mainrun(self) - main game screens change class loop"""
     # start menu screen
     scene_i = menuI.mainrun(functions.get_screen_set())  # [next_window, exit_results]
     if scene_i == "exit":
         # functions.exit_game()
         self.runing = False
         return 0
     elif scene_i == "run":
         self.game_lvl = self.g_lvl
         game_result = self.runing_game()
         if game_result == "exit":
             self.runing = False
             return 0
         elif scene_i == 0:
             return 0
         else:
             # functions.update_records(game_result)
             pass
     elif scene_i == "restore":
         lll = functions.load_game()
         self.game_lvl = lll["level"]
         self.g_time = lll["time"]
         self.g_score = lll["score"]
         self.balls_pos = lll["balls"]
         game_result = self.runing_game()
         if game_result == "exit":
             self.runing = False
             return 0
         elif scene_i == 0:
             return 0
         else:
             # functions.update_records(game_result)
             pass
     elif scene_i == "setup":
         setup_result = setupI.mainrun(functions.get_screen_set())  # start setup screen
         if setup_result == "exit":
             self.runing = False
             return 0
         else:
             pass
             # functions.update_setup(setup_result)
     elif scene_i == "record":
         rrr = recordI.mainrun(functions.get_screen_set())  # start record screen
         if rrr == "exit":
             self.runing = False
             return 0