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 test_save(): try: logic.loadGlobalDict() logic.globalDict['player_pos'] print ('found save') return True except: set_defualt_vars.main() return False
def test_save(): try: logic.loadGlobalDict() if logic.globalDict['player_pos'] != None: return True else: return False except: return False
def main(): try: logic.loadGlobalDict() if logic.globalDict['cfg_post'] == True: print('Turning on Post FX') cont.activate('vignetting') if logic.globalDict['cfg_ssao'] == True: cont.activate('ssao') except: print('No cfg_post option found') #cont.activate('vignetting') #cont.activate('ssao')
def main(): try: logic.loadGlobalDict() if logic.globalDict['cfg_post'] ==True: print ('Turning on Post FX') cont.activate('vignetting') if logic.globalDict['cfg_ssao'] ==True: cont.activate('ssao') except: print ('No cfg_post option found') #cont.activate('vignetting') #cont.activate('ssao')
def init(cont): own = cont.owner try: if logic.globalDict['player_hp'] == None: logic.globalDict['player_hp'] = 100 except: logic.globalDict['player_hp'] = 100 try: logic.loadGlobalDict() if logic.globalDict['cfg_UI'] =='Small': UI_SCALE = .50 elif logic.globalDict['cfg_UI'] =='Normal': UI_SCALE = .75 elif logic.globalDict['cfg_UI'] =='Large': UI_SCALE = 1 except: print ('No cfg_UI option found') UI_SCALE = .75 #print ('GOT IT') screen_width = render.getWindowWidth() screen_height = render.getWindowHeight() #print (screen_width, screen_height) HUD_compass.position = mathutils.Vector((5.5, -2.65, 0.0)) full_hp.position = mathutils.Vector((5.5, -2.65, 0.02)) hp_add.position = mathutils.Vector((5.5, -2.65, 0.01)) hp_hit.position = mathutils.Vector((5.5, -2.65, 0.01)) HUD_compass.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) full_hp.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) hp_add.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) hp_hit.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) if own['show_hud']: HUD_compass.playAction('fade_in', 1, 10, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) full_hp.playAction('fade_in', 1, 10, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) else: HUD_compass.playAction('fade_in', 1, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) full_hp.playAction('fade_in', 1, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) hp_add.playAction('hp_notify', 30, 30, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) hp_hit.playAction('hp_notify', 30, 30, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = 1) HUD_fade.playAction('fade_in', 10, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed = .2)
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 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 load(): #Load logic.loadGlobalDict() #Now for player information player = logic.getCurrentScene().objects['sintel_col'] player_stats = logic.getCurrentScene().objects['player_stats'] #level props LEVEL_MAIN = logic.getCurrentScene().objects['LEVEL_MAIN'] for prop in LEVEL_MAIN.getPropertyNames(): LEVEL_MAIN[prop] = logic.globalDict['LEVEL_MAIN', prop] #position player.worldPosition = tuple(logic.globalDict['player_pos']) player.worldOrientation = tuple(logic.globalDict['player_ori']) #stats #player_stats['lvl'] = logic.globalDict['player_lvl'] #player_stats['mhp'] = logic.globalDict['player_max_hp'] #player_stats['chp'] = logic.globalDict['player_current_hp'] player_stats['hp'] = logic.globalDict['player_hp'] logic.globalDict['game_notifications'].append('Loaded Game')
def load(): #Load logic.loadGlobalDict() #Now for player information player = logic.getCurrentScene().objects['sintel_col'] player_stats = logic.getCurrentScene().objects['player_stats'] #level props LEVEL_MAIN = logic.getCurrentScene().objects['LEVEL_MAIN'] for prop in LEVEL_MAIN.getPropertyNames(): LEVEL_MAIN[prop] = logic.globalDict['LEVEL_MAIN',prop] #position player.worldPosition = tuple(logic.globalDict['player_pos']) player.worldOrientation = tuple(logic.globalDict['player_ori']) #stats #player_stats['lvl'] = logic.globalDict['player_lvl'] #player_stats['mhp'] = logic.globalDict['player_max_hp'] #player_stats['chp'] = logic.globalDict['player_current_hp'] player_stats['hp'] = logic.globalDict['player_hp'] logic.globalDict['game_notifications'].append('Loaded Game')
def init(cont): own = cont.owner try: if logic.globalDict['player_hp'] == None: logic.globalDict['player_hp'] = 100 except: logic.globalDict['player_hp'] = 100 try: logic.loadGlobalDict() if logic.globalDict['cfg_UI'] == 'Small': UI_SCALE = .50 elif logic.globalDict['cfg_UI'] == 'Normal': UI_SCALE = .75 elif logic.globalDict['cfg_UI'] == 'Large': UI_SCALE = 1 except: print('No cfg_UI option found') UI_SCALE = .75 #print ('GOT IT') screen_width = render.getWindowWidth() screen_height = render.getWindowHeight() #print (screen_width, screen_height) HUD_compass.position = mathutils.Vector((5.5, -2.65, 0.0)) full_hp.position = mathutils.Vector((5.5, -2.65, 0.02)) hp_add.position = mathutils.Vector((5.5, -2.65, 0.01)) hp_hit.position = mathutils.Vector((5.5, -2.65, 0.01)) HUD_compass.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) full_hp.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) hp_add.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) hp_hit.localScale = mathutils.Vector((UI_SCALE, UI_SCALE, UI_SCALE)) if own['show_hud']: HUD_compass.playAction('fade_in', 1, 10, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) full_hp.playAction('fade_in', 1, 10, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) else: HUD_compass.playAction('fade_in', 1, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) full_hp.playAction('fade_in', 1, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) hp_add.playAction('hp_notify', 30, 30, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) hp_hit.playAction('hp_notify', 30, 30, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=1) HUD_fade.playAction('fade_in', 10, 1, layer=0, play_mode=logic.KX_ACTION_MODE_PLAY, speed=.2)