2013-07-02 1 views
1

Знаете ли вы, как анимация обратная от стоп-кадра?о cocos2d CCAnimate. Как начать обратную анимацию из только что остановленного кадра?

ех> кадры анимации являются 1 -> 2 -> 3 -> 4 -> 5

если прикоснуться в 3 кадра затем анимировать 1 -> 2 -> 3 -> 2 -> 1

если я касаюсь 4 кадрами, то анимировать 1 -> 2 -> 3 -> 4 -> 3 -> 2 -> 1

mh ... Невозможно использовать класс CCAnimate?

ответ

0

Вы могли бы попробовать что-то вроде этого:

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

    */ 

} 
Смежные вопросы