コード例 #1
0
    def _set_CSV_symbol(self):
        """Set the csv symbol of the element"""

        if self.name == "MacGyver":
            self._csvSymbol = "M"

        else:
            #We set the path to the json file that contains the correspondence table between name of an element and its symbol
            symbolDictPath = path.setPath("resources", "element.json")

            try:
                jsonDict = open(symbolDictPath)
            except:
                print(
                    "Couldn't open the element.json file in Element._set_CSV_symbol()"
                )

            json_str = jsonDict.read()

            symbolDict = json.loads(
                json_str)  #Convert the string json into a dict

            self._csvSymbol = symbolDict[self.name]["Symbol"]
コード例 #2
0
 def _set_skin(self):
     """Set the path for the skin to be displayed for this element"""
     fileName = self.name.lower() + "-40x40.png"
     self._skin = path.setPath("resources/img", fileName)
コード例 #3
0
    def _set_tiles_path(self):
        """Set the tiles"""

        #Loading the image for the tiles
        self._tilesPath = path.setPath("resources/img","floor-tiles-20x20.png")
コード例 #4
0
    def _set_CSV_Path(self):
        """Set the csv path depending on the number of the level"""

        fileName = "level"+str(self.numLevel)+".csv"
        self._csvPath = path.setPath("resources/levels",fileName)
コード例 #5
0
ファイル: configGame.py プロジェクト: tchappui/MacGyver
def setConfiguration(config_dict):
    """Set all the configuration of the game """

    config_dict["title_screen_path"] = path.setPath("resources/img","title_screen.png")

    return config_dict