def run(self): while True: self.fpsCounter.update(); input(pygame.event.get()); if self.network(): break; Shot.updates(self.shots); self.draw(); print "Lost connection to server"; self.sock.close();
def start(self): thread.start_new_thread(self.listen, ()); while True: if self.fpsLimit.update() and len(self.ships): for i in self.run: self.run[i] = 1; Ship.updates(self.ships, self.shoot); Ship.collide(self.ships, self.shots, self.explosions); Shot.updates(self.shots); self.data = (Ship.to_data(self.ships)); else: time.sleep(0.0005);