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

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

        <legend id='hxWpR'><style id='hxWpR'><dir id='hxWpR'><q id='hxWpR'></q></dir></style></legend>
      1. <tfoot id='hxWpR'></tfoot>

        cocos2d 动画后自动删除精灵

        cocos2d autoremove sprite after animation(cocos2d 动画后自动删除精灵)

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

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

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

            1. <legend id='VThph'><style id='VThph'><dir id='VThph'><q id='VThph'></q></dir></style></legend>
                <tbody id='VThph'></tbody>
                  本文介绍了cocos2d 动画后自动删除精灵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 cocos2d 和 iphone 开发的新手.我想创建一些动画,当一些带有它的精灵的物理对象被破坏时(例如显示飞溅).我想做一些我会说的对象:运行动画并在完成后摧毁自己.然后我想忘记这个对象 - 当动画完成时它应该自动销毁.最好的方法是什么?

                  I'm new to cocos2d and to iphone development at all. I want to create some animation, when some physical object with it's sprite is destroyed (for example to show a splash). And i want to to make some object i will say to: run the animation and destroy yourself when done. Then i want to forget about this object - it should be destroyed automatically when animation is finished. What is the best way to do it?

                  推荐答案

                  您可以使用 CCSequence 创建操作列表.你做的第一个动作应该是你的常规动作(或序列).第二个动作应该是 CCCallFuncND 动作,您可以在其中调用清理函数并传递给定的精灵.

                  You can use CCSequence to create a list of actions. The first action you do should be your regular action (or sequence). The second action should be CCCallFuncND action, where you can call a cleanup function and pass the given sprite.

                  在我的脑海中,我会做这样的事情:

                  Off the top of my head I'd do something like this:

                  CCSprite* mySpriteToCleanup = [CCSprite spriteWithFile:@"mySprite.png"];
                  [self addChild:mySpriteToCleanup];
                  
                  // ... do stuff
                  
                  // start the destroy process
                  id action1 = [CCIntervalAction actionWithDuration:0];  // the action it sounds like you have written above.
                  id cleanupAction = [CCCallFuncND actionWithTarget:self selector:@selector(cleanupSprite:) data:mySpriteToCleanup];
                  id seq = [CCSequence actions:action1, cleanupAction, nil];
                  [mySpriteToCleanup runAction:seq];
                  

                  在清理功能中:

                  - (void) cleanupSprite:(CCSprite*)inSprite
                  {
                      // call your destroy particles here
                      // remove the sprite
                      [self removeChild:inSprite cleanup:YES];
                  }
                  

                  您也可以在这两个动作之间添加另一个动作以用于销毁粒子动作,而不是在结束函数中调用它.

                  You could add in another action between these two actions as well for your destroy particle actions instead of calling that in the end function.

                  这篇关于cocos2d 动画后自动删除精灵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                  Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                  Resume game cocos2d(恢复游戏 cocos2d)
                  Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                  Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                  How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)
                    <legend id='Hxv2c'><style id='Hxv2c'><dir id='Hxv2c'><q id='Hxv2c'></q></dir></style></legend>
                      • <bdo id='Hxv2c'></bdo><ul id='Hxv2c'></ul>
                        <tfoot id='Hxv2c'></tfoot>
                      • <i id='Hxv2c'><tr id='Hxv2c'><dt id='Hxv2c'><q id='Hxv2c'><span id='Hxv2c'><b id='Hxv2c'><form id='Hxv2c'><ins id='Hxv2c'></ins><ul id='Hxv2c'></ul><sub id='Hxv2c'></sub></form><legend id='Hxv2c'></legend><bdo id='Hxv2c'><pre id='Hxv2c'><center id='Hxv2c'></center></pre></bdo></b><th id='Hxv2c'></th></span></q></dt></tr></i><div id='Hxv2c'><tfoot id='Hxv2c'></tfoot><dl id='Hxv2c'><fieldset id='Hxv2c'></fieldset></dl></div>
                      • <small id='Hxv2c'></small><noframes id='Hxv2c'>

                            <tbody id='Hxv2c'></tbody>