Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by pragmatik

Hi Everyone.
I'm newest in programming with inpactJS and I want to know if it is possible to load an animation of entities from a xml file.
Example of XML File:
<Animation>
<frame>
<x>10</x>
<y>40</y>
<w>60</w>
<h>40</h>
</frame>
</Animation>

1 decade ago by stillen

Possible, but you would have to write a function to parse the xml to add the information to the entity. You would also have to make sure your parsed data is the same data type for each parameter.

I think it would be simpler to use a json format to do this, but the api for animation is so simple, that it seems like making more work in the end.

1 decade ago by drhayes

+1 to what stillen said.

What are you trying to do? What is loading the animation from XML a solution for?

1 decade ago by pragmatik

In fact, i developped an app in c++ which makes easy the cutting of sprites on a spritesheet.
This app saves informations in a xml file. And I had wrote a function to parse this file. But in reading the doc of ImpactJS, I haven't saw a function which allow to fill animation from an external file. So I want to know if it's possible, and if yes how i can do that.
#Excuse my english, I'm french ;)

1 decade ago by stillen

It is possible, but would have to be written by yourself. Then this XMLAnimationParse would have to be run each entity's init to set it up. The XML format you wrote out, personally I don't think would be the best XML format, as you only really need the animation name, frames, and time for each node of the XML document and could have the sprite sheet, size etc as a top node for the document, unless you are going to have have custom offsets for each animation sequence, that would need to be in each animations node then and then set in the update of each entity as well.
Page 1 of 1
« first « previous next › last »