def setup_pyglet(self): """Configure Pyglet attributes. """ self.window = window.Window(width=800, height=600, visible=False, caption="Ookoobah", resizable=True, fullscreen=False) self.window.set_fullscreen(True) self.gui = gui.Manager(self.window) clock.schedule_interval_soft(self.tick, 1 / 60) sounds.load()
def __init__(self): super(Game, self).__init__() pyglet.resource.path = settings.RESOURCE_PATH pyglet.resource.reindex() self.window = pyglet.window.Window( width=settings.MAIN_WINDOW_WIDTH , height=settings.MAIN_WINDOW_HEIGHT, vsync=False) self.current_scene = menu.MainMenu(self) sounds.load() music.load() self.unfinished_levels = copy.copy(gamelevel.glevels) self.loaded_level = -1 self.scores = defaultdict(int)
def setup(self, levelname): sounds.load() self.lives = settings.STARTING_LIVES self.update_labels() self.level = level.load(levelname) self.track = track.Track() self.track.add_tracks(self.level.tracks) self.ruby_list = entity.ObjectList({"default": ruby.Ruby}) self.ruby_list.add(self.level.rubies) self.obstacle_list = entity.ObjectList({"default": obstacle.Obstacle, "exit": obstacle.EndLevel}) self.obstacle_list.add(self.level.obstacles) self.spawn_points = entity.ObjectList({"default": obstacle.Spawn}) self.spawn_points.add(self.level.spawn) self.entities.extend(self.spawn_points.objects) self.objects = [self.ruby_list, self.obstacle_list] self.create_cart() self.viewport.reset(Rect(self.cart.gp.x, self.cart.gp.y - self.height / 2, self.width, self.height)) # now check the level contents. self.bg = scene.Background(self.level.layers, self.viewport)