def referenceAnimation(self, coordinates, tilelen): anim = Animation("NoResource", coordinates[2], coordinates[3], coordinates[0], coordinates[1], tilelen) self.animations.append(anim) newNode = Element("animation", attrib = {"name" : "", "path" : str(anim.path), "texturex" : str(anim.texturex), "texturey" : str(anim.texturey), "texturew" : str(anim.texturew), "textureh" : str(anim.textureh), "tilelen" : str(tilelen)}) self.xmlNode.append(newNode) anim.xmlNode = newNode return anim
def loadSprites(self, node): for elem in node.findall("sprite"): sprite = Sprite(elem.attrib["path"], elem.attrib["texturex"], elem.attrib["texturey"], elem.attrib["texturew"], elem.attrib["textureh"]) self.sprites.append(sprite) sprite.xmlNode = elem self.emit("sprite-added", sprite) for elem in node.findall("animation"): anim = Animation(elem.attrib["path"], elem.attrib["texturex"], elem.attrib["texturey"], elem.attrib["texturew"], elem.attrib["textureh"], elem.attrib["tilelen"]) self.animations.append(anim) anim.xmlNode = elem self.emit("sprite-added", anim)