def update(self, screen, event): self.next = 'Run' self.previous = 'Init' if not self.game_data : self.game_data = tools.create_game_data_dict() if self.game_data['score'] > self.game_data['highscore']: self.game_data['highscore'] = self.game_data['score'] self.done = True
def startup(self, *args): self.renderer = tilerender.Renderer(self.tmx_map) self.map_image = self.renderer.make_2x_map() self.map_rect = self.map_image.get_rect() self.viewport = self.make_viewport(self.map_image) self.level_surface = pg.Surface(self.map_rect.size) self.title_box = self.set_image() self.title_rect = self.title_box.get_rect() self.title_rect.midbottom = self.viewport.midbottom self.title_rect.y -= 30 self.game_data = tools.create_game_data_dict() self.next = self.set_next_scene() self.state_dict = self.make_state_dict() self.name = c.MAIN_MENU self.state = c.TRANSITION_IN self.alpha = 255 self.transition_surface = pg.Surface(setup.SCREEN_RECT.size) self.transition_surface.fill(c.BLACK_BLUE) self.transition_surface.set_alpha(self.alpha) self.observers = [observer.SoundEffects()]
def startup(self, current_time, game_data): self.game_data = game_data self.font = pg.font.Font(setup.FONTS[c.MAIN_FONT], 22) self.background = pg.Surface(setup.SCREEN_RECT.size) self.background.fill(c.BLACK_BLUE) self.player = person.Player('down', self.game_data, 1, 1, 'resting', 1) self.player.image = pg.transform.scale2x(self.player.image) self.player.rect = self.player.image.get_rect() self.player.rect.center = setup.SCREEN_RECT.center self.message_box = self.make_message_box() self.arrow = Arrow(300, 532) self.state_dict = self.make_state_dict() self.state = c.TRANSITION_IN self.alpha = 255 self.name = c.DEATH_SCENE self.transition_surface = pg.Surface(setup.SCREEN_RECT.size) self.transition_surface.fill(c.BLACK_BLUE) self.transition_surface.set_alpha(self.alpha) if not os.path.isfile("save.p"): game_data = tools.create_game_data_dict() pickle.dump(game_data, open("save.p", "wb")) self.observers = [observer.SoundEffects()]
def update(self, screen, event): if not self.game_data: self.game_data = tools.create_game_data_dict() if self.game_data['score'] > self.game_data['highscore']: self.game_data['highscore'] = self.game_data['score'] self.done = True