def __init__(self, *args): if args: print 'CONNECTING TO', args self.client = Client(args[0], TCP_PORT) else: print 'CONNECTING TO localhost' self.server = Server(TCP_PORT) self.client = Client('localhost', TCP_PORT) self.player = Player(client=self.client) self.bind_keys() self.init_scene() render.attachNewNode(makeBox((1, 0, 0, 1), (0, 0, 0), 1000, 0.5, 0.5)) render.attachNewNode(makeBox((0, 1, 0, 1), (0, 0, 0), 0.5, 1000, 0.5))
def __init__(self, pid=0, client=None, draw=False): self.pid = pid self.client = client self.geom = makeBox((1, random.random(), 1, 1), (0, 0, 0), 5, 5, 5) if draw: self.node = render.attachNewNode(self.geom) else: self.node = NodePath('player_%s' % self.pid) self.node.attachNewNode(self.geom) self.movement = { 'forward': False, 'backward': False, 'left': False, 'right': False, }