Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone 关于椰子酸盐。如何从刚停止的帧开始反转动画?_Cocos2d Iphone_Reverse - Fatal编程技术网

Cocos2d iphone 关于椰子酸盐。如何从刚停止的帧开始反转动画?

Cocos2d iphone 关于椰子酸盐。如何从刚停止的帧开始反转动画?,cocos2d-iphone,reverse,Cocos2d Iphone,Reverse,你知道动画是如何从停止帧反转的吗 ex>动画帧为1->2->3->4->5 如果我在3帧处触摸,则设置1->2->3->2->1的动画 如果我在4帧处触摸,则设置动画1->2->3->4->3->2->1 嗯。。。没有办法使用cAnimate类吗?您可以尝试以下方法: - (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { //Here "numbers" is your Animation Sprite

你知道动画是如何从停止帧反转的吗

ex>动画帧为1->2->3->4->5

如果我在3帧处触摸,则设置1->2->3->2->1的动画

如果我在4帧处触摸,则设置动画1->2->3->4->3->2->1


嗯。。。没有办法使用cAnimate类吗?

您可以尝试以下方法:

- (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.

    */

}