Beispiel #1
0
    """
    print "GID MAP:"
    for k in sorted(data.gidmap.keys()):
        print "  {}: {}\t{}".format(k,
                                    data.gidmap[k],
                                    data.getTilePropertiesByGID(data.gidmap[k]))
    """

    # load the level geometry from the 'control' layer 
    rects = []
    for rect in buildDistributionRects(data, "Control", real_gid=1):
        rects.append(Rect(rect))

    area.setLayerGeometry(0, rects)
    area.tileheight = data.tileheight
    area.tilewidth = data.tilewidth

    # load the npc's and place them in the default positions 
    npcs = [ p for p in props if p[1].get('group', None) == 'npc' ] 

    for (gid, prop) in npcs:
        pos = data.getTileLocation(gid)
        if len(pos) > 1:
            msg = "control gid: {} is used in more than one locaton"
            raise Exception, msg.format(gid)

        x, y, z = toWorld(data, pos.pop())
        thing = area._parent.getChildByGUID(int(prop['guid']))
        debug("adding thing {} at {}".format(thing, (x, y, z)))
        area.add(thing, (x, y, z))