Question

I am using andengine and I have an animated Sprite.

I use scene.animate(duration,0,5,1) to animate the sprite from first tile to the last.

I am wondering if somehow I could do the animation backwards so that it starts from the last tile to the first tile.
What I need to get is 0,1,2,3,4,5,4,3,2,1,0 .

Was it helpful?

Solution

Try this,

sprite.animate(long[] pFrameDurations, int[] pFrames, int pLoopCount)

where Animate specifics frames

Parameters:
    pFrameDurations: indicates the time delays between animations and must have the same length as pFrames.
    pFrames: indices of the frames to animate. // Here you specify your 0,1,2,3,4,5,4,3,2,1,0
    pLoopCount: indicates the no of times you want to repeat the animation 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top