def __init__ (self, x=0, y=0, h=0, car=0): #mydir = os.path.abspath(sys.path[0]) #mydir = Filename.fromOsSpecific(mydir).getFullpath() if car == 0: self.model = loader.loadModel("cars/bluecar.egg") elif car == 1: self.model = loader.loadModel("cars/redcar.egg") elif car == 2: self.model = loader.loadModel("cars/greencar.egg") else: self.model = loader.loadModel("cars/yellowcar.egg") #self.model = Actor("models/panda-model") self.model.reparentTo(render) #self.model.setScale(.005) self.model.setScale(5.7) #things that matter self.model.setPos(x, y, 0) self.model.setH(h) self.vel = Velocity() self.turn = 0 self.hp = 100 self.deaths = 0 self.input = [False for i in range(5)]#left, right, up, down, space #Attach Smoke self.s1 = False self.s2 = False self.s3 = False self.smoke1 = smoke_emitter(self.model, 1, 1, 1) self.smoke2 = smoke_emitter(self.model, -1, 0, 1) self.smoke3 = smoke_emitter(self.model, 0, 1, 0) #taskMgr.add(self.move, "outtaThaWayImDrivingHere") #self.prevtime = 0 self.setUpHeadlights()
for target in self.targets: cSphere = CollisionSphere((0,0,0), 2) cNode = CollisionNode("smiley") cNode.addSolid(cSphere) cNodePath = target.attachNewNode(cNode) #cNodePath.show() def eat(self, cEntry): """handles panda eating a smiley""" #remove target from list of targets self.targets.remove(cEntry.getIntoNodePath().getParent()) #remove from scene graph cEntry.getIntoNodePath().getParent().remove() self.panda.play("eat") global panda_window_action, panda_window_ip_address print panda_window_action, panda_window_ip_address w = World() game_fog() init_smoke() smoke_emitter(w.panda, 0, 0, 500) if panda_window_action == "host": w.cars = CarData([(0,0), (0,5), (5,5), (5,0)], 0) w.connection = pythonServer.Network(w.cars) elif panda_window_action == "connect": print "Made it to client creation" w.cars = CarData([(0,0), (0,5), (5,5), (5,0)], 0) w.connection = pythonClient.Client(w.cars, panda_window_ip_address) run()