<legend id='LT81A'><style id='LT81A'><dir id='LT81A'><q id='LT81A'></q></dir></style></legend>
    <bdo id='LT81A'></bdo><ul id='LT81A'></ul>
  • <i id='LT81A'><tr id='LT81A'><dt id='LT81A'><q id='LT81A'><span id='LT81A'><b id='LT81A'><form id='LT81A'><ins id='LT81A'></ins><ul id='LT81A'></ul><sub id='LT81A'></sub></form><legend id='LT81A'></legend><bdo id='LT81A'><pre id='LT81A'><center id='LT81A'></center></pre></bdo></b><th id='LT81A'></th></span></q></dt></tr></i><div id='LT81A'><tfoot id='LT81A'></tfoot><dl id='LT81A'><fieldset id='LT81A'></fieldset></dl></div>

    <small id='LT81A'></small><noframes id='LT81A'>

      <tfoot id='LT81A'></tfoot>
      1. 如何暂停和恢复应用于 ccSprite 的操作?

        how to pause and resume action applied to the ccSprite?(如何暂停和恢复应用于 ccSprite 的操作?)

          <small id='72hbk'></small><noframes id='72hbk'>

        • <tfoot id='72hbk'></tfoot>

                <tbody id='72hbk'></tbody>
                <bdo id='72hbk'></bdo><ul id='72hbk'></ul>
                <legend id='72hbk'><style id='72hbk'><dir id='72hbk'><q id='72hbk'></q></dir></style></legend>
                <i id='72hbk'><tr id='72hbk'><dt id='72hbk'><q id='72hbk'><span id='72hbk'><b id='72hbk'><form id='72hbk'><ins id='72hbk'></ins><ul id='72hbk'></ul><sub id='72hbk'></sub></form><legend id='72hbk'></legend><bdo id='72hbk'><pre id='72hbk'><center id='72hbk'></center></pre></bdo></b><th id='72hbk'></th></span></q></dt></tr></i><div id='72hbk'><tfoot id='72hbk'></tfoot><dl id='72hbk'><fieldset id='72hbk'></fieldset></dl></div>
                  本文介绍了如何暂停和恢复应用于 ccSprite 的操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我创建了一个类似

                          [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
                       @"Actor.plist"];
                      spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"];
                      [self addChild:spriteSheet];
                      NSMutableArray *walkAnimFrames = [NSMutableArray array];
                      for(int i = 1; i <= 8; ++i) {
                          [walkAnimFrames addObject:
                           [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
                            [NSString stringWithFormat:@"clip000%d.png", i]]];
                      }
                      CCAnimation *walkAnim = [CCAnimation 
                                               animationWithFrames:walkAnimFrames delay:0.07f];
                      playWalkSound = [CCCallFuncN actionWithTarget:self selector:@selector(PlayRunningSound:)];
                  
                      walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
                      [actor runAction:[CCSpawn actions:walkAction, nil]];
                  

                  我想在特定帧和特定触发器上暂停此动画.然后在特定触发后再次恢复动画.

                  I want to pause this animation on particular frame and particular trigger. and then again resume animation after particular trigger.

                  我尝试使用 stopAction,然后再次使用 runAction.但它在一些迭代后停止工作.我需要再次制作动画和动作才能再次运行该动画.

                  I tried using stopAction and then again runAction. But it stops working after some iteration. and i need to crate animation and action again in order to run that animation again.

                  我尝试使用 pauseSchedulerAndAction 和 resumeSchedulerandAction 但随后游戏暂停,如果我尝试再次触发暂停而不恢复游戏崩溃.

                  I tried using pauseSchedulerAndAction and resumeSchedulerandAction but then game get paused and if i try to trigger pause again without resuming game crashes.

                  是否有任何东西会暂停特定帧上的动画并从同一帧再次恢复.

                  is there anything that will pause the animation on particular frame and resum again from same frame.

                  推荐答案

                  我通过创建 1 帧动画解决了我的问题

                  I solved my problem by creating a animation with 1 frame

                  [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
                   @"Actor.plist"];
                  spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"];
                  [self addChild:spriteSheet];
                  NSMutableArray *walkAnimFrames = [NSMutableArray array];
                  for(int i = 1; i <2; ++i) {
                      [walkAnimFrames addObject:
                       [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
                        [NSString stringWithFormat:@"clip000%d.png", i]]];
                  }
                  CCAnimation *walkAnim = [CCAnimation 
                                           animationWithFrames:walkAnimFrames delay:0.07f];
                  playWalkSound = [CCCallFuncN actionWithTarget:self selector:@selector(PlayRunningSound:)];
                  
                  walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
                  [actor runAction:[CCSpawn actions:walkAction, nil]];
                  

                  我使用上面的代码来暂停我的动画动作.并在我想恢复动画动作时添加以下代码.

                  i used the above code where i want to pause my animation action. and added following code when i want to resume the animation action.

                  [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
                       @"Actor.plist"];
                      spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"Actor.pvr.ccz"];
                      [self addChild:spriteSheet];
                      NSMutableArray *walkAnimFrames = [NSMutableArray array];
                      for(int i = 1; i <= 8; ++i) {
                          [walkAnimFrames addObject:
                           [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
                            [NSString stringWithFormat:@"clip000%d.png", i]]];
                      }
                      CCAnimation *walkAnim = [CCAnimation 
                                               animationWithFrames:walkAnimFrames delay:0.07f];
                      playWalkSound = [CCCallFuncN actionWithTarget:self selector:@selector(PlayRunningSound:)];
                  
                      walkAction = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
                      [actor runAction:[CCSpawn actions:walkAction, nil]];
                  

                  这篇关于如何暂停和恢复应用于 ccSprite 的操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                  [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                    <tbody id='nAazf'></tbody>
                    <tfoot id='nAazf'></tfoot>

                    <small id='nAazf'></small><noframes id='nAazf'>

                    • <i id='nAazf'><tr id='nAazf'><dt id='nAazf'><q id='nAazf'><span id='nAazf'><b id='nAazf'><form id='nAazf'><ins id='nAazf'></ins><ul id='nAazf'></ul><sub id='nAazf'></sub></form><legend id='nAazf'></legend><bdo id='nAazf'><pre id='nAazf'><center id='nAazf'></center></pre></bdo></b><th id='nAazf'></th></span></q></dt></tr></i><div id='nAazf'><tfoot id='nAazf'></tfoot><dl id='nAazf'><fieldset id='nAazf'></fieldset></dl></div>

                          <legend id='nAazf'><style id='nAazf'><dir id='nAazf'><q id='nAazf'></q></dir></style></legend>

                          • <bdo id='nAazf'></bdo><ul id='nAazf'></ul>