def fighting(self, my_hero): self.clear_screen() my_map = Map(my_hero.get_hero_lvl()) my_monster = Monster(my_map.get_map_monster_lvl_range(), my_hero.get_hero_lvl()) start_fight = self.big_font.render('=== Start Fight ===', 1, self.color) self.DISPLAYSURF.blit(start_fight, (self.dimension - 350, self.dimension - 350)) pygame.display.update() fight = Fight(my_hero, my_monster) fight.fighting(my_hero.get_hero_hp(), my_monster.get_monster_hp()) fight_log = fight.get_fight_log() position = self.dimension - 300 stop = False while stop is False: for line in fight_log: if position <= 450: rendered_line = self.big_font.render(line, 1, self.color) self.DISPLAYSURF.blit(rendered_line, (self.dimension - 350, position)) position += 25 pygame.display.update() if fight_log.index(line) == len(fight_log) - 1: stop = True else: pygame.time.delay(1000) self.clear_screen() position = self.dimension - 300 rendered_line = self.big_font.render(line, 1, self.color) self.DISPLAYSURF.blit(rendered_line, (self.dimension - 350, position)) position += 25 pygame.display.update() if fight_log.index(line) == len(fight_log) - 1: stop = True if fight is False: self.hero_died()
def spawn_monster(self): my_map = Map(self.my_hero.get_hero_lvl()) my_monster = Monster(my_map.get_map_monster_lvl_range(), self.my_hero.get_hero_lvl()) return my_monster