I am working on Wi-Engine and currently facing the issue while loading two sheets into zwoptex manager.
In the code below I am loading two sheets (sheeta and sheetb), with two animations which are stored as actions in class (firstAction, secondAction). Later when I runAction on the sprite on button click, the firstAction runs fine but the secondAction uses the texture of firstAction with frames of second, which causes unexpected result. kindly if you can let me know what I am missing or doing wrong.
`
/******** Loading Sheet 1********/
Texture2D tex = Texture2D.makePNG(R.drawable.sheeta);
ZwoptexManager.addZwoptex("sheeta", R.raw.sheeta, tex);
/******** Loading Sheet 2********/
Texture2D tex2 = Texture2D.makePNG(R.drawable.sheetb);
ZwoptexManager.addZwoptex("sheetb", R.raw.sheetb,tex2);
petSprite = ZwoptexManager.makeSprite("image_1.png"); // image_1 is in Sheeta
/******* Creating Animations and Actions ******/
Animation firstAnimation = new Animation(0);
for (int i = 1; i <= 9; i++)
{
firstAnimation.addFrame(0.1f, ZwoptexManager.getFrameRect("sheeta", "image_" + i + ".png"));
}
Animate a = (Animate)Animate.make(firstAnimation).autoRelease();
firstAction = (Action)Repeat.make(a, 2);
Animation secondAnimation = new Animation(0);
for (int i = 10; i <= 20; i++)
{
secondAnimation.addFrame(0.1f, ZwoptexManager.getFrameRect("sheetb",
"image_" + i + ".png"));
}
Animate b = (Animate)Animate.make(secondAnimation).autoRelease();
secondAction = (Action)Repeat.make(b, 1);
`
The following is the proper way to get animations working, for those who are having the same problem.