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 中检测触摸?

        时间:2024-04-14
        <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 中检测触摸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我应该继承 CCSprite、CCNode 还是 NSObject? 下一篇:空 cocos2d 2.0 (iPhone) 中的编译错误

                  相关文章

                  <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'>

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