How to use the pytmx.tmxloader3.TiledTileset function in PyTMX

To help you get started, we’ve selected a few PyTMX examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraft / PyTMX / pytmx / tmxloader3.py View on Github external
def parse_tileset(node, firstgid=None):
        """
        parse a tileset element and return a tileset object and properties for tiles as a dict
        """

        tileset = TiledTileset()
        set_properties(tileset, node)
        tiles = {}

        if firstgid != None:
            tileset.firstgid = firstgid

        # since tile objects probably don't have a lot of metadata,
        # we store it separately from the class itself
        for child in node.childNodes:
            if child.nodeName == "tile":
                p = get_properties(child)
                gid = p["id"] + tileset.firstgid
                del p["id"]
                tiles[gid] = p

        # check for tiled "external tilesets"