• <tfoot id='I7U70'></tfoot>
  • <legend id='I7U70'><style id='I7U70'><dir id='I7U70'><q id='I7U70'></q></dir></style></legend>

      <bdo id='I7U70'></bdo><ul id='I7U70'></ul>

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

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

        Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵

        Cocos2D help: How to rotate a sprite continuously and generate child sprites in the rotating sprite(Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵)
          <tbody id='0qr0p'></tbody>
        <tfoot id='0qr0p'></tfoot>

          <small id='0qr0p'></small><noframes id='0qr0p'>

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

                  本文介绍了Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我是 cocos2D 的新手,谁能建议一个简单的解决方案?

                  I am new to cocos2D can anyone suggest an easy solution to the problem?

                  我有一个风车,风车上有 8 个条,每个条相隔 45 度,其中一半在屏幕上,一半在屏幕外.我想旋转风车,让它永远旋转.另外我想在风车杆的末端附加一个孩子,它会随着风车旋转.一个简单的解决方案将不胜感激.

                  I have a windmill with 8 bars on the windmill with each bar separated by 45 degrees, where half of the windmill is on screen and half is outside the screen. I want to rotate the windmill and make it rotate forever. Also I want to attach a child at the end of the windmill bars and it will rotate along with the windmill. An easy solution would be appreciated.

                  编辑

                  我可以旋转风车,我写了这段代码:

                  I was able to rotate the windmill with, I wrote this piece of code:

                  windmill = [CCSprite spriteWithFile:@"Chorki.png"];
                  windmill.position = CGPointMake(winSize.width*0.02f, winSize.height*0.56f);
                  windmill.scale = 0.55f;
                  [self addChild:windmill z:0];
                  CCRotateBy *rot = [CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:5 angle: 360]];
                  [windmill runAction:rot];
                  

                  现在请帮助我如何在每个风车条的末尾添加子精灵,总共有 8 个条,每个条相隔 45 度.

                  Now please help me on how to add child sprite at the end of each windmill bars, there are 8 bars in total and each bar is separated by 45 degrees.

                  推荐答案

                  要让 CCSprite 永远旋转,你可以使用类似

                  To make a CCSprite to rotate forever you could use something like

                  [windmill runAction:[CCRepeatForever actionWithAction:[CCRotateBy actionWithDuration:5.0 angle:360]]];
                  

                  然后添加任何 CCSprite 作为子项,它也会旋转.你分配给孩子的位置是基于他的父母,考虑到这一点.

                  then add any CCSprite as a child it will rotate too. The position that you assign to a child is based on his parent, take that in account.

                  编辑 1

                  好吧,如果您知道圆的半径,您可以进行一些数学运算并得到您想要的位置.但是,如果您不需要计算位置,只需尝试 &错误得到你想要的.试试不旋转的风车.

                  Well, if you know the radius of the circle you can make some maths and get the position that you want. But also, if you don't need to calculate the positions, just try & error to get what you want. Try with the windmill without rotation.

                  这篇关于Cocos2D求助:如何连续旋转一个精灵并在旋转的精灵中生成子精灵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 图形)
                  How to convert 32 bit PNG to RGB565?(如何将 32 位 PNG 转换为 RGB565?)
                  Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                    <bdo id='yD9YF'></bdo><ul id='yD9YF'></ul>

                    1. <small id='yD9YF'></small><noframes id='yD9YF'>

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