def referenceSprite(self, coordinates): sprite = Sprite("NoResource", coordinates[2], coordinates[3], coordinates[0], coordinates[1]) self.sprites.append(sprite) newNode = Element("sprite", attrib = {"name" : "", "path" : str(sprite.path), "texturex" : str(sprite.texturex), "texturey" : str(sprite.texturey), "texturew" : str(sprite.texturew), "textureh" : str(sprite.textureh)}) self.xmlNode.append(newNode) sprite.xmlNode = newNode
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)