Example #1
0
def run(gameStateObj, metaDataObj):
    gameStateObj.message.append(Dialogue.Dialogue_Scene('Data/fight_quote_info.txt', event_flag=False, if_flag=True))
    gameStateObj.stateMachine.changeState('dialogue')
    counter = 0
    while gameStateObj.message:
        Engine.update_time()
        counter += 1
        if not counter%50:
            pyautogui.press('x')
        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()
def run(gameStateObj, metaDataObj, fp):
    if os.path.exists(fp):
        print(fp)
        gameStateObj.message.append(Dialogue.Dialogue_Scene(fp, unit=gameStateObj.allunits[0], if_flag=True))
        gameStateObj.stateMachine.changeState('dialogue')
        counter = 0
        while gameStateObj.message:
            Engine.update_time()
            counter += 1
            if not counter%50:
                pyautogui.press('x')
            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()
Example #3
0
def run(gameStateObj, metaDataObj, unit):
    print(unit.name)
    unit.isDying = True
    gameStateObj.stateMachine.changeState('dying')
    gameStateObj.message.append(Dialogue.Dialogue_Scene(metaDataObj['death_quotes'], unit, event_flag=False))
    gameStateObj.stateMachine.changeState('dialogue')
    counter = 0
    while gameStateObj.message:
        Engine.update_time()
        counter += 1
        if not counter%50:
            pyautogui.press('x')
        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()
Example #4
0
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)