Ejemplo n.º 1
0
 def start_match_simulation(self):    
     
     self.match_simulation.step(
         self.build_player_command_types(), self.match_simulation.timestep
     )
     
     #initialize renderer state
     self.player_renderer_state.update(
         self.match_simulation.get_rendering_info(
         ).player_rendering_info_dictionary, 
         1
     )
     
     #start simulation process
     self.simulation_process = multiprocessing.Process(
         target=self.match_simulation.run,
         name="Way of the stick simulation"
     )
     gamestate.processes.append(self.simulation_process)
     self.simulation_process.start()
     
     #reset game clock
     gamestate.clock.tick(gamestate.frame_rate)
     gamestate.update_time()
     gamestate.clock.tick(gamestate.frame_rate)
     gamestate.update_time()
Ejemplo n.º 2
0
if __name__ == "__main__":
    multiprocessing.freeze_support()
    gamestate.init_pygame_vars()
    screen = gamestate.screen
    pygame.display.set_caption("Way of the Stick")
    music.init()
    
    if len(sys.argv) >= 2 and sys.argv[1] == "dev":
        gamestate.devmode = True
    
    while 1:
        try:
            if gamestate.drawing_mode == gamestate.DrawingModes.UPDATE_ALL:
                screen.fill((0,0,0))
            
            gamestate.update_time()
            wotsuievents.get_events()
            
            events = wotsuievents.events
            event_types = wotsuievents.event_types
            mousePos = wotsuievents.mouse_pos
            mouseButtonsPressed = wotsuievents.mouse_buttons_pressed
            
            music.update()
            
            if pygame.QUIT in event_types:
                if (versusmode.local_state != None and
                versusmode.local_state.simulation_process != None):
                    
                    if versusmode.local_state.simulation_process.is_alive():
                        print("terminating!")