def __init__(self, file_name): '''Sets everything up: camera, modes, lighting, sounds, and the list of objects''' self.set_up_graphics() self.makeLights() self.objects, self.player_loc = LoadWorld.load(file_name) self.camera = Camera(self.player_loc[0],0,self.player_loc[1]) glClearColor(.529,.8078,.980,0) glutIdleFunc(self.display) glutDisplayFunc(self.display) glutIgnoreKeyRepeat(GLUT_KEY_REPEAT_OFF) glutKeyboardFunc(self.keyPressed) glutKeyboardUpFunc(self.keyUp) glutSetCursor(GLUT_CURSOR_NONE) glutPassiveMotionFunc(self.mouseMove) self.door = Model('Graphics/basicdoor.obj','door') self.key = Model('Graphics/Key.obj', 'key') self.zombie = Model('Graphics/zombie.obj', 'zombie') self.chest = Model('Graphics/treasure.obj', 'chest') self.soundboard = GameSounds() self.footSound = self.soundboard.toSound("Sound/footsteps.wav") self.collisionSound = self.soundboard.toSound("Sound/crashsound.wav") self.pickSound = self.soundboard.toSound("Sound/picksound.wav") self.zomSound = self.soundboard.toSound("Sound/zombie.wav") self.fanSound = self.soundboard.toSound("Sound/fanfare.wav") self.soundboard.loadMusic("Sound/music.wav") self.soundboard.playMusic() self.zomstart = time() glutMainLoop()
def __init__(self, file_name): """Sets everything up: camera, modes, lighting, and the list of blocks""" self.camera = Camera() self.set_up_graphics() self.makeLights() self.objects = LoadWorld.load(file_name) glClearColor(0.529, 0.8078, 0.980, 0) glutIdleFunc(self.display) glutDisplayFunc(self.display) glutIgnoreKeyRepeat(GLUT_KEY_REPEAT_OFF) glutKeyboardFunc(self.keyPressed) glutKeyboardUpFunc(self.keyUp) glutSetCursor(GLUT_CURSOR_NONE) glutPassiveMotionFunc(self.mouseMove) self.fence = Model("Graphics/humanoid_quad.obj") glutMainLoop()
def __init__(self, file_name): '''Sets up camera, modes, lighting, sounds, and objects.''' self.set_up_graphics() self.makeLights() self.objects, self.player_loc = LoadWorld.load(file_name) self.camera = Camera(self.player_loc[0],0,self.player_loc[1]) glClearColor(.529,.8078,.980,0) glutIdleFunc(self.display) glutDisplayFunc(self.display) glutIgnoreKeyRepeat(GLUT_KEY_REPEAT_OFF) glutKeyboardFunc(self.keyPressed) glutKeyboardUpFunc(self.keyUp) glutSetCursor(GLUT_CURSOR_NONE) glutPassiveMotionFunc(self.mouseMove) self.floor_texture = Image.open("Graphics/checkerboard.bmp") self.ix, self.iy = self.floor_texture.size self.floor = self.floor_texture.tostring("raw", "RGBX", 0, -1) self.door = Model('Graphics/basicdoor.obj','door') self.key = Model('Graphics/Key.obj', 'key') self.zombie = Model('Graphics/zombie.obj', 'zombie')#try zombie5.obj for fun sometime self.chest = Model('Graphics/treasure.obj', 'chest') self.soundboard = GameSounds() self.footSound = self.soundboard.toSound("Sound/footsteps.wav") self.collisionSound = self.soundboard.toSound("Sound/crashsound.wav") self.pickSound = self.soundboard.toSound("Sound/picksound.wav") self.zomSound = self.soundboard.toSound("Sound/zombie.wav") self.fanSound = self.soundboard.toSound("Sound/fanfare.wav") self.soundboard.loadMusic("Sound/music.wav") self.soundboard.playMusic() self.zomstart = time() glutMainLoop()