How to use the pytmx.tmxloader3.TiledMap 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_map(node):
        """
        parse a map node from a tiled tmx file
        return a tiledmap
        """

        tiledmap = TiledMap()
        tiledmap.filename = filename
        set_properties(tiledmap, map_node)

        for node in map_node.getElementsByTagName("tileset"):
            t, tiles = parse_tileset(node)
            tiledmap.tilesets.append(t)
            tiledmap.tile_properties.update(tiles)

        for node in dom.getElementsByTagName("layer"):
            l = parse_layer(tiledmap.tilesets, node)
            tiledmap.tilelayers.append(l)
            tiledmap.layers.append(l)

        for node in dom.getElementsByTagName("objectgroup"):
            o = parse_objectgroup(node)
            tiledmap.objectgroups.append(o)