Cocos2d iphone 关于椰子酸盐。如何从刚停止的帧开始反转动画?
你知道动画是如何从停止帧反转的吗 ex>动画帧为1->2->3->4->5 如果我在3帧处触摸,则设置1->2->3->2->1的动画 如果我在4帧处触摸,则设置动画1->2->3->4->3->2->1Cocos2d 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
嗯。。。没有办法使用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.
*/
}