def load_breakable(breakable, gap_x, gap_y): # Static data x = int(breakable.find('position/x').text) * TILE_SIZE + gap_x y = int(breakable.find('position/y').text) * TILE_SIZE + gap_y pos = (x, y) sprite = 'imgs/dungeon_crawl/dungeon/' + breakable.find('sprite').text.strip() hp = int(breakable.find('current_hp').text.strip()) return Breakable(pos, sprite, hp, 0, 0)
from src.Level import Level from src.StartScreen import StartScreen from src import LoadFromXMLManager as Loader pg.init() # Load fonts fonts.init_fonts() # Window parameters pg.display.set_caption("In the name of the Five Cats") screen = pg.display.set_mode((MAIN_WIN_WIDTH, MAIN_WIN_HEIGHT)) # Load constant sprites Destroyable.init_constant_sprites() Breakable.init_constant_sprites() Movable.init_constant_sprites() Sidebar.init_constant_sprites() Level.init_constant_sprites() # Load some data races = Loader.load_races() classes = Loader.load_classes() Character.init_data(races, classes) clock = pg.time.Clock() start_screen = StartScreen(screen) quit_game = False while not quit_game: