你知道动画是如何从停止帧反转的吗?
ex> 动画帧是 1 -> 2 -> 3 -> 4 -> 5
如果我在 3 帧处触摸,则为 1 -> 2 -> 3 -> 2 -> 1 设置动画
如果我在 4 帧处触摸,则为 1 -> 2 -> 3 -> 4 -> 3 -> 2 -> 1 设置动画
嗯……有没有办法使用 CCAnimate 类?
你知道动画是如何从停止帧反转的吗?
ex> 动画帧是 1 -> 2 -> 3 -> 4 -> 5
如果我在 3 帧处触摸,则为 1 -> 2 -> 3 -> 2 -> 1 设置动画
如果我在 4 帧处触摸,则为 1 -> 2 -> 3 -> 4 -> 3 -> 2 -> 1 设置动画
嗯……有没有办法使用 CCAnimate 类?
你可以尝试这样的事情:
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//Here "numbers" is your Animation Sprite
//Get display frame of the sprite
CCSpriteFrame *currentFrame = [numbers displayFrame];
GLuint index = currentFrame.texture.name;
//Use this index to determine current frame's index
//Beware!!! As I know it will not return a zero based index, so check it out with an output
/*
NEXT :
- Now you know the current frame index, let's say it is 3
- Re-order your spriteFrames like 3->2->1 (You have new spriteFrames array)
- CCAnimation with this spriteFrames array
- CCAction with this CCAnimation
- Run the Action!!! There, your reversed animation.
*/
}