1. <tfoot id='f6TQy'></tfoot>

    2. <small id='f6TQy'></small><noframes id='f6TQy'>

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

          <bdo id='f6TQy'></bdo><ul id='f6TQy'></ul>
        <legend id='f6TQy'><style id='f6TQy'><dir id='f6TQy'><q id='f6TQy'></q></dir></style></legend>
      1. 如何在 cocos2d 中检测触摸?

        How can I detect touch in cocos2d?(如何在 cocos2d 中检测触摸?)
        <i id='IYINK'><tr id='IYINK'><dt id='IYINK'><q id='IYINK'><span id='IYINK'><b id='IYINK'><form id='IYINK'><ins id='IYINK'></ins><ul id='IYINK'></ul><sub id='IYINK'></sub></form><legend id='IYINK'></legend><bdo id='IYINK'><pre id='IYINK'><center id='IYINK'></center></pre></bdo></b><th id='IYINK'></th></span></q></dt></tr></i><div id='IYINK'><tfoot id='IYINK'></tfoot><dl id='IYINK'><fieldset id='IYINK'></fieldset></dl></div>
          <tbody id='IYINK'></tbody>

              <legend id='IYINK'><style id='IYINK'><dir id='IYINK'><q id='IYINK'></q></dir></style></legend>
              <tfoot id='IYINK'></tfoot>

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

              • <bdo id='IYINK'></bdo><ul id='IYINK'></ul>
                  本文介绍了如何在 cocos2d 中检测触摸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I am developing a 2d game for iPhone by using cocos2d.

                  I use many small sprite (image) in my game. I want to touch two similar types of sprite(image) and then both sprite(image) will be hidden.

                  How can I detect touch in a specific sprite(image) ?

                  解决方案

                  In your layer that contains your sprite, you need to say:

                  self.isTouchEnabled = YES;
                  

                  then you can use the same events that you would use in a UIView, but they're named a little differently:

                  - (void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
                  {
                     UITouch* touch = [touches anyObject];
                    //in your touchesEnded event, you would want to see if you touched
                    //down and then up inside the same place, and do your logic there.
                  }
                  

                  这篇关于如何在 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?)

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

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

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

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

                            <tbody id='WPG0K'></tbody>