def save_settings(): fullscreen_option = logic.getCurrentScene().objects['fullscreen_option'] post_option = logic.getCurrentScene().objects['post_option'] ssao_option = logic.getCurrentScene().objects['ssao_option'] LOD_option = logic.getCurrentScene().objects['LOD_option'] resolution_option = logic.getCurrentScene().objects['resolution_option'] difficulty_option = logic.getCurrentScene().objects['difficulty_option'] ui_scale_option = logic.getCurrentScene().objects['ui_scale_option'] cfg_fullscreen = str(fullscreen_option['option']) res = resolution_option['option'] res = res.split('x') cfg_screen_width = str(res[0]) cfg_screen_height = str(res[1]) print('Saving config file...') #print (cfg_fullscreen, cfg_screen_width, cfg_screen_height) set_settings = open('sintel_config.ini', 'w') set_settings.write(cfg_screen_width + "\n") set_settings.write(cfg_screen_height + "\n") set_settings.write(cfg_fullscreen) set_settings.close() logic.globalDict['cfg_post'] = post_option['option'] logic.globalDict['cfg_ssao'] = ssao_option['option'] logic.globalDict['cfg_LOD'] = LOD_option['option'] logic.globalDict['cfg_difficulty'] = difficulty_option['option'] logic.globalDict['cfg_UI'] = ui_scale_option['option'] print(logic.globalDict['cfg_difficulty']) logic.saveGlobalDict() render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height))
def save(): #Start by saving the current level name try: LEVEL_MAIN = logic.getCurrentScene().objects['LEVEL_MAIN'] logic.globalDict['level_name'] = LEVEL_MAIN['level_name'] logic.globalDict['Load_Next'] = LEVEL_MAIN['level_name'] #save all of the level's properties for prop in LEVEL_MAIN.getPropertyNames(): logic.globalDict['LEVEL_MAIN', prop] = LEVEL_MAIN[prop] print(logic.globalDict['LEVEL_MAIN', prop]) except: print('LEVEL_MAIN not found. Current level will not be saved.') logic.globalDict['level_name'] = 'default' #Now for player information player = logic.getCurrentScene().objects['sintel_col'] player_stats = logic.getCurrentScene().objects['player_stats'] #position logic.globalDict['player_pos'] = list(player.worldPosition) logic.globalDict['player_ori'] = list(player.worldOrientation[0]), list( player.worldOrientation[1]), list(player.worldOrientation[2]) #stats #logic.globalDict['player_lvl'] = player_stats['lvl'] #logic.globalDict['player_max_hp'] = player_stats['mhp'] #logic.globalDict['player_current_hp'] = player_stats['chp'] logic.globalDict['player_hp'] = player_stats['hp'] #Save logic.saveGlobalDict() #print('Saved Game') logic.globalDict['game_notifications'].append('Saved Game')
def set_active(item): item['active'] = True logic.globalDict['Load_Next'] = item['text'] print ('will load ',logic.globalDict['Load_Next'], 'next.') logic.saveGlobalDict() #cont.activate(load_game) cont.activate('fade_out')
def save(): #Start by saving the current level name try: LEVEL_MAIN = logic.getCurrentScene().objects['LEVEL_MAIN'] logic.globalDict['level_name'] = LEVEL_MAIN['level_name'] logic.globalDict['Load_Next'] = LEVEL_MAIN['level_name'] #save all of the level's properties for prop in LEVEL_MAIN.getPropertyNames(): logic.globalDict['LEVEL_MAIN',prop] = LEVEL_MAIN[prop] print (logic.globalDict['LEVEL_MAIN',prop]) except: print ('LEVEL_MAIN not found. Current level will not be saved.') logic.globalDict['level_name'] = 'default' #Now for player information player = logic.getCurrentScene().objects['sintel_col'] player_stats = logic.getCurrentScene().objects['player_stats'] #position logic.globalDict['player_pos'] = list(player.worldPosition) logic.globalDict['player_ori'] = list(player.worldOrientation[0]),list(player.worldOrientation[1]),list(player.worldOrientation[2]) #stats #logic.globalDict['player_lvl'] = player_stats['lvl'] #logic.globalDict['player_max_hp'] = player_stats['mhp'] #logic.globalDict['player_current_hp'] = player_stats['chp'] logic.globalDict['player_hp'] = player_stats['hp'] #Save logic.saveGlobalDict() #print('Saved Game') logic.globalDict['game_notifications'].append('Saved Game')
def save_settings(): fullscreen_option = logic.getCurrentScene().objects['fullscreen_option'] post_option = logic.getCurrentScene().objects['post_option'] ssao_option = logic.getCurrentScene().objects['ssao_option'] LOD_option = logic.getCurrentScene().objects['LOD_option'] resolution_option = logic.getCurrentScene().objects['resolution_option'] difficulty_option = logic.getCurrentScene().objects['difficulty_option'] ui_scale_option = logic.getCurrentScene().objects['ui_scale_option'] cfg_fullscreen = str(fullscreen_option['option']) res = resolution_option['option'] res = res.split('x') cfg_screen_width = str(res[0]) cfg_screen_height = str(res[1]) print ('Saving config file...') #print (cfg_fullscreen, cfg_screen_width, cfg_screen_height) set_settings = open('sintel_config.ini', 'w') set_settings.write(cfg_screen_width+"\n") set_settings.write(cfg_screen_height+"\n") set_settings.write(cfg_fullscreen) set_settings.close() logic.globalDict['cfg_post'] = post_option['option'] logic.globalDict['cfg_ssao'] = ssao_option['option'] logic.globalDict['cfg_LOD'] = LOD_option['option'] logic.globalDict['cfg_difficulty'] = difficulty_option['option'] logic.globalDict['cfg_UI'] = ui_scale_option['option'] print (logic.globalDict['cfg_difficulty']) logic.saveGlobalDict() render.setWindowSize(int(cfg_screen_width), int(cfg_screen_height))
def main(cont): own = cont.owner #give each enemy a unique ID try: ID = logic.globalDict['ID'] = logic.globalDict['ID'] + 1 except: ID = logic.globalDict['ID'] = 0 own['ID'] = ID #find out what type of enemy this is if own['TYPE'] == '': if 'snail_rig' in own.children: own['TYPE'] = 'snail' elif 'bandit_rig' in own.children: own['TYPE'] = 'bandit' elif 'rock_snake_rig' in own.children: own['TYPE'] = 'rock_snake' elif 'wing_nip_rig' in own.children: own['TYPE'] = 'wing_nip' #print ("Enemy ID:", ID, own['TYPE']) #each enemy has it's own list of threats logic.globalDict[own['TYPE'] + '_' + str(own['ID']) + '_threat'] = [] logic.saveGlobalDict() #done initializing own.state = logic.KX_STATE2
def set_active(item): item['active'] = True logic.globalDict['Load_Next'] = item['text'] print('will load ', logic.globalDict['Load_Next'], 'next.') logic.saveGlobalDict() #cont.activate(load_game) cont.activate('fade_out')
def main(cont): own = cont.owner #give each enemy a unique ID try: ID = logic.globalDict['ID'] = logic.globalDict['ID'] + 1 except: ID = logic.globalDict['ID'] = 0 own['ID'] = ID #find out what type of enemy this is if own['TYPE'] == '': if 'snail_rig' in own.children: own['TYPE'] = 'snail' elif 'bandit_rig' in own.children: own['TYPE'] = 'bandit' elif 'rock_snake_rig' in own.children: own['TYPE'] = 'rock_snake' elif 'wing_nip_rig' in own.children: own['TYPE'] = 'wing_nip' #print ("Enemy ID:", ID, own['TYPE']) #each enemy has it's own list of threats logic.globalDict[own['TYPE']+ '_' + str(own['ID']) + '_threat'] = [] logic.saveGlobalDict() #done initializing own.state = logic.KX_STATE2
def main(): #defualt cfg_screen_width = '1024' cfg_screen_height = '768' cfg_fullscreen = 'True' fullscreen_option = logic.getCurrentScene().objects['fullscreen_option'] post_option = logic.getCurrentScene().objects['post_option'] ssao_option = logic.getCurrentScene().objects['ssao_option'] LOD_option = logic.getCurrentScene().objects['LOD_option'] resolution_option = logic.getCurrentScene().objects['resolution_option'] difficulty_option = logic.getCurrentScene().objects['difficulty_option'] ui_scale_option = logic.getCurrentScene().objects['ui_scale_option'] try: load_settings = open('sintel_config.ini', 'r') #load screen width cfg_screen_width = load_settings.readline() cfg_screen_width = cfg_screen_width[0:-1] #screen height cfg_screen_height = load_settings.readline() cfg_screen_height = cfg_screen_height[0:-1] #fullscreen option cfg_fullscreen = load_settings.readline() cfg_fullscreen = cfg_fullscreen load_settings.close() print('Loaded settings:', cfg_screen_width, cfg_screen_height, cfg_fullscreen) except: print('Creating config file') set_settings = open('sintel_config.ini', 'w') set_settings.write(cfg_screen_width + "\n") set_settings.write(cfg_screen_height + "\n") set_settings.write(cfg_fullscreen) set_settings.close() try: logic.loadGlobalDict() post_option['option'] = logic.globalDict['cfg_post'] ssao_option['option'] = logic.globalDict['cfg_ssao'] LOD_option['option'] = logic.globalDict['cfg_LOD'] difficulty_option['option'] = logic.globalDict['cfg_difficulty'] ui_scale_option['option'] = logic.globalDict['cfg_UI'] except: print('Saving Global Dict') logic.globalDict['cfg_post'] = True logic.globalDict['cfg_LOD'] = 'High' logic.globalDict['cfg_difficulty'] = 'Easy' logic.globalDict['cfg_UI'] = 'Normal' logic.saveGlobalDict() if cfg_fullscreen == 'True': fullscreen_option['option'] = True else: fullscreen_option['option'] = False resolution_option['option'] = cfg_screen_width + 'x' + cfg_screen_height
def main(): #defualt cfg_screen_width = '1024' cfg_screen_height = '768' cfg_fullscreen = 'True' fullscreen_option = logic.getCurrentScene().objects['fullscreen_option'] post_option = logic.getCurrentScene().objects['post_option'] ssao_option = logic.getCurrentScene().objects['ssao_option'] LOD_option = logic.getCurrentScene().objects['LOD_option'] resolution_option = logic.getCurrentScene().objects['resolution_option'] difficulty_option = logic.getCurrentScene().objects['difficulty_option'] ui_scale_option = logic.getCurrentScene().objects['ui_scale_option'] try: load_settings = open('sintel_config.ini', 'r') #load screen width cfg_screen_width = load_settings.readline() cfg_screen_width = cfg_screen_width[0:-1] #screen height cfg_screen_height = load_settings.readline() cfg_screen_height = cfg_screen_height[0:-1] #fullscreen option cfg_fullscreen = load_settings.readline() cfg_fullscreen = cfg_fullscreen load_settings.close() print ('Loaded settings:', cfg_screen_width, cfg_screen_height, cfg_fullscreen) except: print ('Creating config file') set_settings = open('sintel_config.ini', 'w') set_settings.write(cfg_screen_width+"\n") set_settings.write(cfg_screen_height+"\n") set_settings.write(cfg_fullscreen) set_settings.close() try: logic.loadGlobalDict() post_option['option'] = logic.globalDict['cfg_post'] ssao_option['option'] = logic.globalDict['cfg_ssao'] LOD_option['option'] = logic.globalDict['cfg_LOD'] difficulty_option['option'] = logic.globalDict['cfg_difficulty'] ui_scale_option['option'] = logic.globalDict['cfg_UI'] except: print ('Saving Global Dict') logic.globalDict['cfg_post'] = True logic.globalDict['cfg_LOD'] = 'High' logic.globalDict['cfg_difficulty'] = 'Easy' logic.globalDict['cfg_UI'] = 'Normal' logic.saveGlobalDict() if cfg_fullscreen == 'True': fullscreen_option['option'] = True else: fullscreen_option['option'] = False resolution_option['option'] = cfg_screen_width+'x'+cfg_screen_height
def set_active(item): item['active'] = True if item['ID'] == 1: logic.globalDict['game_load'] = False logic.saveGlobalDict() if item['ID'] == 0: logic.globalDict['game_load'] = True logic.globalDict['Load_Next'] = logic.globalDict['level_name'] print ('setting loading file to:',logic.globalDict['Load_Next']) logic.saveGlobalDict()
def load_game(): load() logic.globalDict['game_load'] = True logic.saveGlobalDict() cont = logic.getCurrentController() own = cont.owner loading = cont.actuators['loading'] cont.activate(loading)
def init_create_vars(): print('creating new vars') own = logic.getCurrentController().owner logic.globalDict['ID'] = 0 logic.globalDict['game_load'] = False logic.globalDict['player_pos'] = None logic.globalDict['player_ori'] = None logic.globalDict['player_hp'] = 100 logic.globalDict['game_notifications'] = [] logic.globalDict['game_last_notification'] = '' logic.globalDict['game_objective'] = '' logic.globalDict['sintel_0_threat'] = [] logic.saveGlobalDict() start_game()
def init_create_vars(): print ('creating new vars') own = logic.getCurrentController().owner logic.globalDict['ID'] = 0 logic.globalDict['game_load'] = False logic.globalDict['player_pos'] = None logic.globalDict['player_ori'] = None logic.globalDict['player_hp'] = 100 logic.globalDict['game_notifications'] = [] logic.globalDict['game_last_notification'] = '' logic.globalDict['game_objective'] = '' logic.globalDict['sintel_0_threat'] = [] logic.saveGlobalDict() start_game()
def set_active(item): item['active'] = True if item['ID'] == 1: logic.globalDict['game_load'] = False set_defualt_vars.main(False) #logic.saveGlobalDict() #render.showMouse(0) if item['ID'] == 0: menu_music.volume = 0 menu_music.stopSound() cont.deactivate(menu_music) logic.globalDict['game_load'] = True logic.globalDict['Load_Next'] = logic.globalDict['level_name'] print ('setting loading file to:',logic.globalDict['Load_Next']) logic.saveGlobalDict() render.showMouse(0)
def init_load(): try: logic.loadGlobalDict() #found a save but we are not loading it - overwrite if logic.globalDict['game_load'] == False: init_create_vars() #loading save else: load() logic.globalDict['game_load'] = False logic.saveGlobalDict() start_game() #no save found except: print ('game_load var not found') init_create_vars()
def init_load(): try: logic.loadGlobalDict() #found a save but we are not loading it - overwrite if logic.globalDict['game_load'] == False: init_create_vars() #loading save else: load() logic.globalDict['game_load'] = False logic.saveGlobalDict() start_game() #no save found except: print('game_load var not found') init_create_vars()
def set_active(item): item['active'] = True if item['ID'] == 1: logic.globalDict['game_load'] = False set_defualt_vars.main(False) #logic.saveGlobalDict() #render.showMouse(0) if item['ID'] == 0: menu_music.volume = 0 menu_music.stopSound() cont.deactivate(menu_music) logic.globalDict['game_load'] = True logic.globalDict['Load_Next'] = logic.globalDict['level_name'] print('setting loading file to:', logic.globalDict['Load_Next']) logic.saveGlobalDict() render.showMouse(0)
def main(): cont = logic.getCurrentController() own = cont.owner # recived the level to load message level_mess = cont.sensors['level_mess'] #Has to load before it saves or else it will overwrite. try: logic.loadGlobalDict() except: pass #print (bge.logic.globalDict.keys()) if level_mess.positive: #print (level_mess.bodies[0]) logic.globalDict['Load_Next'] = level_mess.bodies[0] print('will load ', logic.globalDict['Load_Next'], 'next.') logic.saveGlobalDict() #print ('No save file found, creating one.')
def main(): cont = logic.getCurrentController() own = cont.owner # recived the level to load message level_mess = cont.sensors['level_mess'] #Has to load before it saves or else it will overwrite. try: logic.loadGlobalDict() except: pass #print (bge.logic.globalDict.keys()) if level_mess.positive: #print (level_mess.bodies[0]) logic.globalDict['Load_Next'] = level_mess.bodies[0] print ('will load ',logic.globalDict['Load_Next'], 'next.') logic.saveGlobalDict() #print ('No save file found, creating one.')
def main(new_game): #print ('setting defualt vars') logic.globalDict['game_load'] = False logic.globalDict['player_pos'] = None logic.globalDict['player_ori'] = None logic.globalDict['player_hp'] = 100 logic.globalDict['game_notifications'] = [] logic.globalDict['game_last_notification'] = '' logic.globalDict['game_objective'] = 'test' logic.globalDict['sintel_0_threat'] = [] logic.globalDict['target'] = None logic.globalDict['game_dialog'] = [] logic.globalDict['menu_levels'] = [] logic.globalDict['level_name'] = None ''' logic.globalDict['cfg_post'] = None logic.globalDict['cfg_UI'] = None logic.globalDict['cfg_difficulty'] = None logic.globalDict['cfg_LOD'] = None ''' if new_game == False: logic.globalDict['Load_Next'] = None logic.saveGlobalDict()