How do I create an animation using an xml file with haxeflixel?
So I'm trying to add an animation in haxeflixel and i cant get it to work. So I want to use the .xml file that came with it so I can get width, height, and name of the animation.
Here is my sheet and xml file:
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="bob.png">
<!-- Created with Adobe Animate version 21.0.1.37179 -->
<!-- http://www.adobe.com/products/animate.html -->
<SubTexture name="Idle0000" x="0" y="0" width="228" height="588"/>
<SubTexture name="Idle0001" x="228" y="0" width="228" height="588"/>
<SubTexture name="Idle0002" x="456" y="0" width="228" height="588"/>
<SubTexture name="Idle0003" x="684" y="0" width="228" height="588"/>
<SubTexture name="Idle0004" x="912" y="0" width="228" height="588"/>
<SubTexture name="Idle0005" x="1140" y="0" width="228" height="588"/>
<SubTexture name="Idle0006" x="1368" y="0" width="228" height="588"/>
<SubTexture name="Idle0007" x="1596" y="0" width="228" height="588"/>
<SubTexture name="Idle0008" x="1824" y="0" width="228" height="588"/>
<SubTexture name="Idle0009" x="2052" y="0" width="228" height="588"/>
<SubTexture name="Idle0010" x="2280" y="0" width="228" height="588"/>
<SubTexture name="Idle0011" x="2508" y="0" width="228" height="588"/>
<SubTexture name="Idle0012" x="2736" y="0" width="228" height="588"/>
<SubTexture name="Idle0013" x="2964" y="0" width="228" height="588"/>
<SubTexture name="Idle0014" x="3192" y="0" width="228" height="588"/>
<SubTexture name="Idle0015" x="3420" y="0" width="228" height="588"/>
<SubTexture name="Idle0016" x="3648" y="0" width="228" height="588"/>
<SubTexture name="Idle0017" x="0" y="588" width="228" height="588"/>
<SubTexture name="Idle0018" x="228" y="588" width="228" height="588"/>
<SubTexture name="Idle0019" x="0" y="0" width="228" height="588"/>
<SubTexture name="Walk0000" x="456" y="588" width="250" height="600"/>
<SubTexture name="Walk0001" x="706" y="588" width="250" height="600"/>
<SubTexture name="Walk0002" x="956" y="588" width="250" height="600"/>
<SubTexture name="Walk0003" x="1206" y="588" width="250" height="600"/>
<SubTexture name="Walk0004" x="1456" y="588" width="250" height="600"/>
<SubTexture name="Walk0005" x="1706" y="588" width="250" height="600"/>
<SubTexture name="Walk0006" x="1956" y="588" width="250" height="600"/>
<SubTexture name="Walk0007" x="2206" y="588" width="250" height="600"/>
<SubTexture name="Walk0008" x="456" y="588" width="250" height="600"/>
</TextureAtlas>
and my code:
loadGraphic(sprite.graphic, true, 228, 588); // i dont know if the last 2 values are a frame or the entire image
addAnimation("idle", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], true);
addAnimation("walk", [0, 1, 2, 3, 4, 5, 6, 7], true);
animation.play("idle");
Comments
Post a Comment