def test_level (self, lvl_string): Globals.in_menu = False file = open("assets/levels/%s" % lvl_string) Globals.graphics_level = 2 l = LevelReader() l.read_level(file.read()) file.close() self.play_game()
def resume(self): # loads level level_file = open("assets/levels/l%s.json" % (Globals.graphics_level + 1), "r") r = LevelReader() r.read_level(level_file.read()) level_file.close() self.fade_out = True Globals.music_fade_out = True self.fade_alpha = 0 self.fade_start_time = time.time()
def new_game(self): # Resets everything settings_file = open("assets/settings/settings.json", "r+") old_settings = json.loads(settings_file.read()) new_settings = old_settings.copy() new_settings['graphics_level'] = 0 Globals.graphics_level = 0 self.graphics_level = Globals.graphics_level settings_file.seek(0) settings_file.write(json.dumps(new_settings)) # loads level level_file = open("assets/levels/l1.json", "r") r = LevelReader() r.read_level(level_file.read()) level_file.close() self.fade_out = True Globals.music_fade_out = True self.fade_alpha = 0 self.fade_start_time = time.time()