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

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

        在 cocos2d 中平滑拖动一个 Sprite - iPhone

        Smoothly drag a Sprite in cocos2d - iPhone(在 cocos2d 中平滑拖动一个 Sprite - iPhone)
        1. <i id='8nFly'><tr id='8nFly'><dt id='8nFly'><q id='8nFly'><span id='8nFly'><b id='8nFly'><form id='8nFly'><ins id='8nFly'></ins><ul id='8nFly'></ul><sub id='8nFly'></sub></form><legend id='8nFly'></legend><bdo id='8nFly'><pre id='8nFly'><center id='8nFly'></center></pre></bdo></b><th id='8nFly'></th></span></q></dt></tr></i><div id='8nFly'><tfoot id='8nFly'></tfoot><dl id='8nFly'><fieldset id='8nFly'></fieldset></dl></div>
        2. <small id='8nFly'></small><noframes id='8nFly'>

        3. <legend id='8nFly'><style id='8nFly'><dir id='8nFly'><q id='8nFly'></q></dir></style></legend>
            <tfoot id='8nFly'></tfoot>

              <bdo id='8nFly'></bdo><ul id='8nFly'></ul>
                <tbody id='8nFly'></tbody>
                  本文介绍了在 cocos2d 中平滑拖动一个 Sprite - iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经在精灵对象上实现了如下拖动..

                  I have implemented a drag on a sprite object as follows..

                  -(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
                  
                  UITouch * touch = [touches anyObject];
                  CGPoint location = [[Director sharedDirector] convertCoordinate: [touch locationInView:touch.view]];    
                  [diskSprite setPosition:ccp(location.x , location.y )];
                  return kEventHandled;
                  }
                  

                  但是这种拖动并不顺利.....当我用拇指快速拖动路径左侧的对象时.

                  but this dragging is not smooth..... when i drag fast with my thumb the object left from the path.

                  谢谢

                  推荐答案

                  可能有点晚了,但我正在寻找类似的东西.我发现这个很棒的教程解释了一切:http://www.raywenderlich.com/2343/how-to-拖放精灵与 cocos2d

                  Probably a little bit late but I was searching for a similar thing. I found this great Tutorial which explained everything: http://www.raywenderlich.com/2343/how-to-drag-and-drop-sprites-with-cocos2d

                  - (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {       
                      CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
                  
                      CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
                      oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
                      oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
                  
                      CGPoint translation = ccpSub(touchLocation, oldTouchLocation);    
                      CGPoint newPos = ccpAdd(mySpriteToMove.position, translation);
                      mySpriteToMove.position = newPos;
                  }
                  

                  这篇关于在 cocos2d 中平滑拖动一个 Sprite - iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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]如何禁用自动旋转?)
                • <small id='LXsik'></small><noframes id='LXsik'>

                    • <legend id='LXsik'><style id='LXsik'><dir id='LXsik'><q id='LXsik'></q></dir></style></legend>

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