def loadSprites(self):
        if not self.sprites_loaded_flag:
            self.sprites_loaded_flag = True
            # Handle grabbing normal sprites
            self.map_image = Engine.image_load(self.mapfilename, convert=True)
            Engine.set_colorkey(self.map_image, COLORKEY, rleaccel=True)
            # Auto-tiles
            auto_loc = self.levelfolder + '/Autotiles/'
            self.autotile_frame = 0
            if os.path.exists(auto_loc):
                files = sorted([
                    fp for fp in os.listdir(auto_loc)
                    if fp.startswith('autotile') and fp.endswith('.png')
                ],
                               key=lambda x: int(x[8:-4]))
                imageList = [
                    Engine.image_load(auto_loc + image, convert=True)
                    for image in files
                ]
                for image in imageList:
                    Engine.set_colorkey(image, COLORKEY, rleaccel=True)
                self.autotiles = imageList
            else:
                self.autotiles = []
            # Loose Tile Sprites
            lts_loc = self.levelfolder + '/LooseTileSprites/'
            if os.path.exists(lts_loc):
                itemnameList = [
                    image[:-4] for image in os.listdir(lts_loc)
                    if image.endswith('.png')
                ]
                imageList = [
                    Engine.image_load(lts_loc + image, convert=True)
                    for image in os.listdir(lts_loc) if image.endswith('.png')
                ]
                for image in imageList:
                    Engine.set_colorkey(image, COLORKEY, rleaccel=True)
                self.loose_tile_sprites = dict(zip(itemnameList, imageList))
            else:
                self.loose_tile_sprites = {}

            # Re-add escape highlights if necessary
            for position, tile_values in self.tile_info_dict.iteritems():
                if "Escape" in tile_values or "Arrive" in tile_values:
                    self.escape_highlights[position] = CustomObjects.Highlight(
                        GC.IMAGESDICT["YellowHighlight"])
                if "Formation" in tile_values:
                    self.formation_highlights[
                        position] = CustomObjects.Highlight(
                            GC.IMAGESDICT["BlueHighlight"])

            # Re-add associated status sprites
            for position, value in self.tile_info_dict.iteritems():
                if 'Status' in value:
                    for status in value['Status']:
                        status.loadSprites()
 def parse_tile_line(self, coord, property_list):
     if property_list:
         for tile_property in property_list:
             property_name, property_value = tile_property.split('=')
             # Handle special cases...
             if property_name == 'Status':  # Treasure does not need to be split. It is split by the itemparser function itself.
                 # Turn these string of ids into a list of status objects
                 status_list = []
                 for status in property_value.split(','):
                     status_list.append(StatusObject.statusparser(status))
                 property_value = status_list
             elif property_name in ["Escape", "Arrive"]:
                 self.escape_highlights[coord] = CustomObjects.Highlight(
                     GC.IMAGESDICT["YellowHighlight"])
             elif property_name == "Formation":
                 self.formation_highlights[coord] = CustomObjects.Highlight(
                     GC.IMAGESDICT["BlueHighlight"])
             self.tile_info_dict[coord][property_name] = property_value
     else:
         self.tile_info_dict[coord] = {'Status': []}  # Empty Dictionary