def assign_all(self): self.all_sprites = pg.sprite.Group() self.walls = pg.sprite.Group() self.items = pg.sprite.Group() # We load the map we created with Tiled self.map = tlm.TiledMap(path.join(self.map_folder, st.MAP)) # We define a Surface of width * height to countain the map self.map_img = self.map.make_map() self.map_rect = self.map_img.get_rect() self.end_game = False self.end_game_win = False
def load_data(self): game_folder = path.dirname(__file__) img_folder = path.join(game_folder, "Sprites") map_folder = path.join(game_folder, "Maps") self.map = tilemap.TiledMap(path.join(map_folder, 'entrada.tmx')) self.background = pg.image.load(path.join(img_folder, 'start.jpg')).convert() self.map_img = self.map.make_map() self.intro_img = pg.image.load( path.join(img_folder, settings.INTRO_IMG)).convert_alpha() self.map_rect = self.map_img.get_rect() self.player_img = pg.image.load( path.join(img_folder, settings.PLAYER_IMG)).convert_alpha() #imagem do player self.item_images = {} for item in settings.ITEM_IMAGES: self.item_images[item] = pg.image.load( path.join(img_folder, settings.ITEM_IMAGES[item])).convert_alpha() self.ninja_img = pg.image.load( path.join(img_folder, settings.NINJA_IMG)).convert_alpha()
def load_data(self): game_folder = path.dirname(__file__) snd_folder = path.join(game_folder, 'snd') img_folder = path.join(game_folder, 'img') map_folder = path.join(game_folder, 'map') self.snd_background = pg.mixer.Sound( path.join(snd_folder, 'gaivota.wav')) self.map = tilemap.TiledMap(path.join(map_folder, 'labirinto.tmx')) self.map_img = self.map.Makemap() self.map_rect = self.map_img.get_rect() self.inimigo_img = pg.image.load( path.join(img_folder, settings.PLAYER_IMG)).convert_alpha() self.player_img = pg.image.load( path.join(img_folder, settings.PLAYER_IMG)).convert_alpha() self.madeira_img = pg.image.load( path.join(img_folder, settings.MADEIRA_IMG)).convert_alpha() self.corda_img = pg.image.load( path.join(img_folder, settings.CORDA_IMG)).convert_alpha() self.comida_img = pg.image.load( path.join(img_folder, settings.COMIDA_IMG)).convert_alpha() self.cama_img = pg.image.load(path.join( img_folder, settings.CAMA_IMG)).convert_alpha() self.tocha_img = pg.image.load(path.join( img_folder, settings.TOCHA)).convert_alpha()
def __init__(self, map_file: str) -> None: # init_map self.map = tilemap.TiledMap(map_file) self.labeled_sprites: Dict[str, Set[model.GameObject]] = {} self._init_map_objects()
def load_map(self, filename): #needs random file selection per level, one level hard coded for testing self.map = tilemap.TiledMap(filename) self.map_img = self.map.make_map() self.map_rect = self.map_img.get_rect()