def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() scripts = [ 'preBase', 'in_base_', 'narration', 'intro', 'prep', 'turnChange', 'move', 'menu', 'attack', 'interact' ] for num in range(0, GC.cf.CONSTANTS['num_levels']): print('Level: %s' % num) levelfolder = 'Data/Level' + str(num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) if num == 3: for script in scripts: fp = levelfolder + '/' + script + 'Script.txt' run(gameStateObj, metaDataObj, fp) for _ in range(20): gameStateObj.turncount += 1 fp = levelfolder + '/turnChangeScript.txt' run(gameStateObj, metaDataObj, fp) fp = levelfolder + '/outroScript.txt' run(gameStateObj, metaDataObj, fp) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits)))
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() gameStateObj.set_generic_mode() scripts = [ 'preBase', 'in_base_', 'narration', 'intro', 'prep', 'turnChange', 'move', 'menu', 'attack', 'interact' ] num = 0 while True: levelfolder = 'Assets/Lex-Talionis/Data/Level' + str(num) if not os.path.exists(levelfolder): break print('Level: %s' % num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) if num == 10: for script in scripts: fp = levelfolder + '/' + script + 'Script.txt' run(gameStateObj, metaDataObj, fp) for _ in range(20): gameStateObj.turncount += 1 fp = levelfolder + '/turnChangeScript.txt' run(gameStateObj, metaDataObj, fp) fp = levelfolder + '/outroScript.txt' run(gameStateObj, metaDataObj, fp) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits))) num += 1
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() wait_for = 1 for num in range(0, GC.cf.CONSTANTS['num_levels']): time1 = time.clock() print('Level: %s' % num) SaveLoad.load_level('Data/Level' + str(num), gameStateObj, metaDataObj) print('Time to Load: %s' % (time.clock() - time1)) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) for unit in gameStateObj.allunits: CustomObjects.handle_info_key(gameStateObj, metaDataObj, unit) info_menu = InfoMenu.InfoMenu() info_menu.begin(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) # Move right info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits)))
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() levelfolder = 'Data/Level0' SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) run(gameStateObj, metaDataObj) gameStateObj.clean_up() print('Num Units Remaining: %s'%(len(gameStateObj.allunits)))
def main(): # Set Volume Engine.music_thread.set_volume(cf.OPTIONS['Music Volume']) imagesDict.set_sound_volume(cf.OPTIONS['Sound Volume'], GC.SOUNDDICT) gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.metaDataObj = metaDataObj run(gameStateObj, metaDataObj)
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() for num in range(0, GC.cf.CONSTANTS['num_levels']): time1 = time.clock() print('Level: %s'%num) SaveLoad.load_level('Data/Level' + str(num), gameStateObj, metaDataObj) print('Time to Load: %s'%(time.clock() - time1)) print('Num Units: %s Map Size: %s'%(len(gameStateObj.allunits), gameStateObj.map.width*gameStateObj.map.height)) gameStateObj.clean_up() print('Num Units Remaining: %s'%(len(gameStateObj.allunits)))
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() for num in range(0, GC.cf.CONSTANTS['num_levels']): print('Level: %s'%num) levelfolder = 'Data/Level' + str(num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s'%(len(gameStateObj.allunits), gameStateObj.map.width*gameStateObj.map.height)) for unit in gameStateObj.allunits: run(gameStateObj, metaDataObj, unit) gameStateObj.clean_up() print('Num Units Remaining: %s'%(len(gameStateObj.allunits)))
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() scripts = ['base', 'village', 'unlock', 'switch', 'talk', 'search'] for num in range(0, GC.cf.CONSTANTS['num_levels']): print('Level: %s' % num) levelfolder = 'Data/Level' + str(num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) if num >= 0: for script in scripts: fp = levelfolder + '/' + script + 'Script.txt' run(gameStateObj, metaDataObj, fp) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits)))
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() gameStateObj.set_generic_mode() num = 0 while True: levelfolder = 'Assets/Lex-Talionis/Data/Level' + str(num) if not os.path.exists(levelfolder): break print('Level: %s' % num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width*gameStateObj.map.height)) for unit in gameStateObj.allunits: run(gameStateObj, metaDataObj, unit) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits))) num += 1
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() gameStateObj.set_generic_mode() num = 0 while True: levelfolder = 'Data/Level' + str(num) if not os.path.exists(levelfolder): break time1 = time.clock() print('Level: %s' % num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Time to Load: %s' % (time.clock() - time1)) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits))) num += 1
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() gameStateObj.set_generic_mode() scripts = ['base', 'village', 'unlock', 'switch', 'talk', 'search'] num = 0 while True: levelfolder = 'Data/Level' + str(num) if not os.path.exists(levelfolder): break print('Level: %s' % num) SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width*gameStateObj.map.height)) if num >= 0: for script in scripts: fp = levelfolder + '/' + script + 'Script.txt' run(gameStateObj, metaDataObj, fp) gameStateObj.clean_up() print('Num Units Remaining: %s'%(len(gameStateObj.allunits))) num += 1
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() gameStateObj.set_generic_mode() wait_for = 1 num = 0 while True: levelfolder = 'Assets/Lex-Talionis/Data/Level' + str(num) if not os.path.exists(levelfolder): break print('Level: %s' % num) time1 = time.clock() SaveLoad.load_level('Assets/Lex-Talionis/Data/Level' + str(num), gameStateObj, metaDataObj) print('Time to Load: %s' % (time.clock() - time1)) print('Num Units: %s Map Size: %s' % (len(gameStateObj.allunits), gameStateObj.map.width * gameStateObj.map.height)) for unit in gameStateObj.allunits: CustomObjects.handle_info_key(gameStateObj, metaDataObj, unit) info_menu = InfoMenu.InfoMenu() info_menu.begin(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) # Move right info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) info_menu.move_right(gameStateObj, metaDataObj) for _ in range(wait_for): run(gameStateObj, metaDataObj, info_menu) gameStateObj.clean_up() print('Num Units Remaining: %s' % (len(gameStateObj.allunits))) num += 1
def main(): gameStateObj = GameStateObj.GameStateObj() metaDataObj = {} gameStateObj.build_new() done = False for num in range(0, 12): if hasattr(gameStateObj, 'saving_thread'): gameStateObj.saving_thread.join() gameStateObj.save_slots = Transitions.load_saves() print('Level: %s' % num) gameStateObj.build_new() # Make the gameStateObj ready for a new game gameStateObj.set_generic_mode() gameStateObj.save_slot = 0 levelfolder = 'Assets/Lex-Talionis/Data/Level' + str(num) # Create a save for the first game gameStateObj.stateMachine.clear() gameStateObj.stateMachine.changeState('turn_change') SaveLoad.suspendGame(gameStateObj, "Start", slot=gameStateObj.save_slot) # Load the first level SaveLoad.load_level(levelfolder, gameStateObj, metaDataObj) # Set Casual Mode gameStateObj.mode['death'] = 0 # Run counter = 0 suspended_yet, dead_yet = False, False while not done: Engine.update_time() current_state = gameStateObj.stateMachine.getState() if current_state == 'free': units = [unit for unit in gameStateObj.allunits if unit.team == 'player' and not unit.dead and unit.name not in {'Sam', 'Ophie', 'Prim', 'Renae'}] if not dead_yet and units: unit = units[0] print(unit.name) unit.isDying = True gameStateObj.stateMachine.changeState('dying') gameStateObj.message.append(Dialogue.Dialogue_Scene(metaDataObj['death_quotes'], unit=unit)) gameStateObj.stateMachine.changeState('dialogue') dead_yet = True elif suspended_yet: gameStateObj.statedict['levelIsComplete'] = 'win' gameStateObj.message.append(Dialogue.Dialogue_Scene('Assets/Lex-Talionis/Data/seizeScript.txt')) gameStateObj.stateMachine.changeState('dialogue') suspended_yet = False else: SaveLoad.suspendGame(gameStateObj, 'Suspend', hard_loc='Suspend') gameStateObj.save_slots = None # Reset save slots gameStateObj.stateMachine.clear() gameStateObj.stateMachine.changeState('start_start') suspended_yet = True elif current_state == 'start_save' or current_state == 'start_start' or current_state == 'start_option': pyautogui.press('x') if current_state == 'start_save': dead_yet = False elif current_state == 'move': pyautogui.press('z') counter += 1 if not counter%20: pyautogui.press('s') eventList = Engine.build_event_list() mapSurf, repeat = gameStateObj.stateMachine.update(eventList, gameStateObj, metaDataObj) while repeat: mapSurf, repeat = gameStateObj.stateMachine.update(eventList, gameStateObj, metaDataObj) GC.DISPLAYSURF.blit(mapSurf, (0, 0)) pygame.display.update() gameStateObj.playtime += GC.FPSCLOCK.tick(GC.FPS)