def run(self): port = 8888 s = Listener(port, MyHandler, self) print"running" while 1: key=pygame.key.get_pressed() if key[pygame.K_ESCAPE]: self.start_new_game() sleep(1) poll(timeout=0.001) # in seconds self.process_client_inputs() time_passed = self.gametick() self.send_state(time_passed) # comment this out to improve performance self.drawgame()
def run(self): port = 8888 s = Listener(port, MyHandler, self) print "running" while 1: key = pygame.key.get_pressed() if key[pygame.K_ESCAPE]: self.start_new_game() sleep(1) poll(timeout=0.001) # in seconds self.process_client_inputs() time_passed = self.gametick() self.send_state(time_passed) # comment this out to improve performance self.drawgame()
def periodic_poll(self): while 1: poll() sleep(0.005) # seconds
def run(self): port = 8888 server = Listener(port, MyHandler) while 1: poll(timeout=0.05) # in seconds
def update(self): poll(0.01)