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

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

                  相关文档推荐

                  what#39;s property copy means in Cocoa#39;s Framework?(like UITabBar#39;s items property)(Cocoa 框架中的属性副本是什么意思?(如 UITabBar 的 items 属性))
                  WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                  Difference between retain and copy?(保留和复制的区别?)
                  When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                  Automatically copy property values from one object to another of a different type but the same protocol (Objective-C)(自动将属性值从一个对象复制到另一个类型不同但协议相同的对象 (Objective-C))
                  Selecting text in mobile Safari on iPhone(在 iPhone 上的移动 Safari 中选择文本)

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