def __init__(self): base.disableMouse() # Turns off the default mouse-camera controls in Panda3D. base.setBackgroundColor(0, 0, 0) # Sets the background to black. self.inputManager = InputManager() # Creates an InputManager to handle all of the user input in the game. self.track = Track() # Creates the track the cycles will race on. self.cycle1 = Cycle(self.inputManager, self.track, 1, "Bert", ai=False) self.cycle2 = Cycle(self.inputManager, self.track, 2, "Ernie") # Creates one uncontrolled cycle, and one player controlled cycle. taskMgr.doMethodLater(10, self.debugTask, "Debug Task") # Tells the debugTask to run once every ten seconds. The debug task is a good # place to put various data print outs about the game to help with debugging. self.filters = CommonFilters(base.win, base.cam) filterok = self.filters.setBloom(blend=(0, 0, 0, 1), desat=-0.5, intensity=3.0, size=2) render.setShaderAuto()
def createDemoRace(self): self.hud.hide() # Hides the HUD during the demo. self.destroyRace() # removes any existing race components. self.track = Track() # Creates the track self.cycles.append(Cycle(self.inputManager, self.track, 1, "Bert", ai = True)) self.cycles.append(Cycle(self.inputManager, self.track, 2, "Ernie", ai = True)) self.cycles.append(Cycle(self.inputManager, self.track, 3, "William", ai = True)) self.cycles.append(Cycle(self.inputManager, self.track, 4, "Patrick", ai = True)) # Creates 4 AI controlled cycles. self.setCameraHigh(self.cycles[0]) # Attaches the camera to one cycle self.startRace(1) # Starts the race after 1 second delay. return
def createRace(self): self.hud.hide() # Hides the HUD because cycles are about to be destroyed. self.destroyRace() # removes any existing race components. self.track = Track() # Creates the track self.cycles.append(Cycle(self.inputManager, self.track, 1, "Bert")) self.cycles.append(Cycle(self.inputManager, self.track, 2, "Ernie", ai = True)) self.cycles.append(Cycle(self.inputManager, self.track, 3, "William", ai = True)) self.cycles.append(Cycle(self.inputManager, self.track, 4, "Patrick", ai = True)) # Creates 1 player controlled cycle and 3 AI controlled cycles. self.hud.setCycle(self.cycles[0]) self.hud.show() # Sets the hude to report on the player cycle, and makes it visible. self.setCameraFollow(self.cycles[0]) # Attaches the camera to one cycle return
def __init__(self): base.disableMouse() # Turns off the default mouse-camera controls in Panda3D. base.setBackgroundColor(0, 0, 0) # Sets the background to black. self.inputManager = InputManager() # Creates an InputManager to handle all of the user input in the game. self.track = Track() # Creates the track the cycles will race on. self.cycle1 = Cycle(self.inputManager, self.track, 1, "Bert", ai=False) self.cycle2 = Cycle(self.inputManager, self.track, 2, "Ernie") # Creates one uncontrolled cycle, and one player controlled cycle. taskMgr.doMethodLater(10, self.debugTask, "Debug Task")