<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>cocos2d for iPhone &#187; Tag: touches - Recent Posts</title>
		<link>http://www.cocos2d-iphone.org/forum/tags/touches</link>
		<description>A fast, easy to use, free, and community supported 2D game engine</description>
		<language>en-US</language>
		<pubDate>Fri, 10 Feb 2012 02:50:10 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://www.cocos2d-iphone.org/forum/search.php</link>
		</textInput>
		<atom:link href="http://www.cocos2d-iphone.org/forum/rss/tags/touches" rel="self" type="application/rss+xml" />

		<item>
			<title>Duckwit on "[?] Seriously Mislead as to &#039;Multi-Touch&#039; - Will not receive touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28497#post-140355</link>
			<pubDate>Fri, 20 Jan 2012 07:56:08 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">140355@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>:O Haha @<a href='http://www.cocos2d-iphone.org/forum/profile/31820'>wilczarz</a> - Thanks!<br />
Funny how all the multitouch tutorials/blogs/posts/topics I have read all over the internet NEVER point out that I need to do that. </p>
<p>:D Thanks
</p></description>
		</item>
		<item>
			<title>elsevero on "Swallowing touches disables touches on layer?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/22712#post-140354</link>
			<pubDate>Fri, 20 Jan 2012 07:55:57 +0000</pubDate>
			<dc:creator>elsevero</dc:creator>
			<guid isPermaLink="false">140354@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>@<a href='http://www.cocos2d-iphone.org/forum/profile/49435'>jackrabbit</a>: Have you found a solution?
</p></description>
		</item>
		<item>
			<title>wilczarz on "[?] Seriously Mislead as to &#039;Multi-Touch&#039; - Will not receive touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28497#post-140279</link>
			<pubDate>Thu, 19 Jan 2012 22:02:08 +0000</pubDate>
			<dc:creator>wilczarz</dc:creator>
			<guid isPermaLink="false">140279@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Did you enable multitouch in your app delegate?
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?] Seriously Mislead as to &#039;Multi-Touch&#039; - Will not receive touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28497#post-140271</link>
			<pubDate>Thu, 19 Jan 2012 21:28:42 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">140271@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Right,<br />
I am learning to program the touch input for my control system.<br />
I have posted various topics and read many tutorials, all to (almost) no avail. </p>
<p>At first I needed a method to manage multiple touches. Thanks to @<a href='http://www.cocos2d-iphone.org/forum/profile/1750'>hactar</a> I have my buttons store a UITouch and check to see if it corresponds with current touches on the screen. </p>
<p>Now I just plainly and simply want to receive the touches. Full. Stop. </p>
<p>"What?"</p>
<p>Why is this happening:<br />
-------------------------<br />
TL;DR<br />
-------------------------<br />
This code:<br />
<pre><code>-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSSet *allTouches = [event allTouches];
for (UITouch* touch in allTouches)
printf(&#34;A TOUCH\n&#34;);
...</code></pre>
<p>...should receive touches that begin - correct?<br />
This is what happens:<br />
1.Put one finger on the screen (Output prints 'A TOUCH')<br />
2.Touch with another finger while holding down the first finger - Nothing.<br />
3. Tap, swipe, bang the iPod on your flesh until it (and your hand) are bleeding - Nothing. :3 </p>
<p>Why does this happen, and what should I do to make it work properly? </p>
<p>NOTE:<br />
I also tried:<br />
<pre><code>NSArray* allTouches = [[event allTouches] allObjects]; //&#60;-- EDIT
for (UITouch* touch in allTouches)</code></pre>
<p>and<br />
<pre><code>NSArray* allTouches = [[touches allTouches] allObjects];
for (UITouch* touch in allTouches)
...</code></pre>
<p>Thanks for any tips/pointers :)
</p></description>
		</item>
		<item>
			<title>ktowncoder on "Why is my basic case touch detection not working?"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28461#post-140088</link>
			<pubDate>Wed, 18 Jan 2012 19:43:07 +0000</pubDate>
			<dc:creator>ktowncoder</dc:creator>
			<guid isPermaLink="false">140088@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I can't understand why this isn't working- I am not swallowing touches, or anything, unless I am missing something..</p>
<pre><code>-(id) init{
    self = [super init];

    if (self!=nil){
        CCSprite *titleSprite = [CCSprite spriteWithFile:@&#34;introScreen.png&#34;];
        [self addChild:titleSprite z:0];
        [titleSprite setPosition:CGPointMake(160, 240)];
        self.isTouchEnabled=YES;
        [self schedule:@selector(splashTimerCallback) interval:2.0];
    }

    return self;
}

-(void) splashTimerCallback{
    [self unschedule:@selector(splashTimerCallback)];
    AppDelegate *delegate= [[UIApplication sharedApplication] delegate];
    [delegate toLoginScene];
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

}
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [self splashTimerCallback];
    printf(&#34;Touched\n&#34;);
}</code></pre>
<p>Cheers!
</p></description>
		</item>
		<item>
			<title>LittleBitStudio on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-140066</link>
			<pubDate>Wed, 18 Jan 2012 18:27:04 +0000</pubDate>
			<dc:creator>LittleBitStudio</dc:creator>
			<guid isPermaLink="false">140066@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>fwiw, I used the hash property (unsigned int / NSUInteger) to track and compare touches.
</p></description>
		</item>
		<item>
			<title>hactar on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-140058</link>
			<pubDate>Wed, 18 Jan 2012 17:53:20 +0000</pubDate>
			<dc:creator>hactar</dc:creator>
			<guid isPermaLink="false">140058@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Yup.
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-140042</link>
			<pubDate>Wed, 18 Jan 2012 16:36:35 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">140042@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks @<a href='http://www.cocos2d-iphone.org/forum/profile/1750'>hactar</a> for detailing the way you handle touch input.<br />
I have just one concern :)<br />
How should I go about checking if one touch matches another? Can I just use:<br />
<pre><code>if (something) ItemOne.touch = someTouch; 

//Later on...
if (someTouch == ItemOne.touch) //code</code></pre></description>
		</item>
		<item>
			<title>hactar on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-140016</link>
			<pubDate>Wed, 18 Jan 2012 13:35:39 +0000</pubDate>
			<dc:creator>hactar</dc:creator>
			<guid isPermaLink="false">140016@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>The touches methods only provide you with the changed touches, not all touches (you can access  all the touches on screen by using event.allTouches, but then you are most likely not using the touches methods correctly and will have issues later in the line, trust me, I've been there and rewrote my touch code). </p>
<p>If a user touches the screen with 2 fingers perfectly at the same time you'll get 1 touchesBegan callback with two touches. If the fingers are only slightly off, you'll get two touchesBegan callbacks with 1 touch each.</p>
<p>If the user moves exactly 1 finger, then you'll receive 1 touchesMoved callback with just one of the touches being in the set, the other finger didnt move so it is not included in the touchesMoves set.</p>
<p>Same goes for ended.</p>
<p>How I do it in Zen Wars:</p>
<p>Objects that can be manipulated through touches get their own UITouch property.</p>
<p>On begin touch, loop through all touches that just began, and assign them to what they are intended to do. If a touch is touching the red players build piece then i set the build pieces UITouch property to that and do anything I need to do, such as add a glow effect around that object.</p>
<p>On move I loop through all touches and check if any of the touches corresponds to an objects UITouch property, if it does then I update that object, such as for example move it to the new position.</p>
<p>On end touch I loop through all touches and check if any of the touches corresponds to an objects UITouch property, if it does then I do what ever I need to do with that object on touch end and set the objects UITouch property back to nil.
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-139969</link>
			<pubDate>Wed, 18 Jan 2012 07:52:21 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">139969@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I guess so, but I would prefer learning how to properly manage this 'manually'.<br />
Thanks for the advice @<a href='http://www.cocos2d-iphone.org/forum/profile/20492'>varedis</a> - I will certainly try that out if this doesn't work out. </p>
<p>Anybody else have any idea how to work this?
</p></description>
		</item>
		<item>
			<title>varedis on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-139915</link>
			<pubDate>Tue, 17 Jan 2012 21:44:52 +0000</pubDate>
			<dc:creator>varedis</dc:creator>
			<guid isPermaLink="false">139915@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Could you not use CCMenu for your buttons? This is the way league of evil does it.
</p></description>
		</item>
		<item>
			<title>Duckwit on "[?] Touch Manipulation Logic Fail - Help with Control System"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28426#post-139910</link>
			<pubDate>Tue, 17 Jan 2012 21:11:31 +0000</pubDate>
			<dc:creator>Duckwit</dc:creator>
			<guid isPermaLink="false">139910@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I've been playing around with this for some hours now, and I'm still confused as to how I should solve this apparently complex puzzle. </p>
<p>-There are 3 buttons - move right, move left, and jump.<br />
-I am using the ccTouchesBegan/Moved/Ended methods and taking into account the sprite.boundingBox thing to check for touches. </p>
<p>Check if there is a touch in the box? Done.<br />
Check, if there are more than two touches, if one of them touches the box. &#60;- Aghem.  </p>
<p>Okay wait, I know how to check if two touches are there and one of them is within bounds.<br />
The problem is the order/way touches are received. </p>
<p>As far as I am aware there is no way to just get an array or NSSet* of touches present on the screen. Only touches that have just begun, that have just moved, or have just ended. </p>
<p>So what I ask, basically, is this:<br />
How do I check if a touch is THERE?<br />
1. touchBegan<br />
2.User is till holding his finger on the screen, but no method is called because they only trigger when it begins, moves, or ends. </p>
<p>Right. </p>
<p>So I have a BOOLEAN variable to control whether or not the button is held down. </p>
<p>1. TouchBegins - BOOL = YES;<br />
2. Touch Moves - How do I check if the touch has moved OFF the button? Think about this for a moment.<br />
Consider this scenario:<br />
1.TouchBegins - BOOL = YES;<br />
2.Touch2Begins - SomethingElse = YES;<br />
3.Touch2 Moves, but Touch1 does not, so it is not included in the array: I check to see if any of the touches hit the button, they don't, so now the application thinks also somethingElse is activated. </p>
<p>The first touch has been lost in translation. The user is still pressing the button on the screen, but I have no way of tracking the touch, especially when other touches are moving/beginning/ending that cause even more confusion. </p>
<p>I've read various tutorials, but none of them seem to cover interpreting these situations.<br />
I would really like some help with this, or just a friendly pointer in the right direction. </p>
<p>Thanks. :)
</p></description>
		</item>
		<item>
			<title>pabloruiz55 on "Polling Layer for current touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27962#post-139123</link>
			<pubDate>Wed, 11 Jan 2012 20:52:21 +0000</pubDate>
			<dc:creator>pabloruiz55</dc:creator>
			<guid isPermaLink="false">139123@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi guys, thanks for the info.<br />
I was doing what both suggested, but have some trouble dealing with the persisted touches if i stopped touching while the next scene loaded.</p>
<p>Nevertheless, i solved it by changing the code so instead of loading another scene, removing the current layer and creating a new one. This was also done for other reasons too, not just this one. I didn't want to lose the power of transitions, but i had to :(<br />
Thanks!
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-138617</link>
			<pubDate>Sun, 08 Jan 2012 13:01:34 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">138617@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hallo, Ok, it took me some time to try everything you have posted. But I found out, that my cocos seems to have a multitouch problem in general. Here <a href="http://www.qcmat.com/dragging-multiple-sprites-in-cocos2d/" rel="nofollow">http://www.qcmat.com/dragging-multiple-sprites-in-cocos2d/</a> it says, that you can now drag multiple sprites at once. I downloaded the sample code, and noticed, that I cant drag multiple sprites (I test on my iPhone 4S, are there any known problems with the 4S and cocos?).</p>
<p>Do you know any general problems. Probably I have chosen the wrong configuration or something like that.<br />
Thanks,<br />
Jannes
</p></description>
		</item>
		<item>
			<title>Birkemose on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137832</link>
			<pubDate>Tue, 03 Jan 2012 22:01:47 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">137832@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It is hard to say where you go wrong as we have no code to look at, and I know it is hard to post code, as the problem might expand over several classes.<br />
However. @<a href='http://www.cocos2d-iphone.org/forum/profile/8755'>joni8a</a> suggest you use true multitouch. While this certainly is an option, it is NOT trivial, and most implementations I have seen, are crude hacks that will break very easily.<br />
The main idea is to create touch delegates for the objects you want to be able to touch, and you will only ever need to implement true multitouch, if you want to be able to multitouch a single object. That would be zooming, rotating, making gestures, and stuff like that.</p>
<p>Try reading what Ray has to say about it.<br />
<a href="http://www.raywenderlich.com/2343/how-to-drag-and-drop-sprites-with-cocos2d" rel="nofollow">http://www.raywenderlich.com/2343/how-to-drag-and-drop-sprites-with-cocos2d</a><br />
And then check this<br />
<a href="http://www.qcmat.com/dragging-multiple-sprites-in-cocos2d/" rel="nofollow">http://www.qcmat.com/dragging-multiple-sprites-in-cocos2d/</a>
</p></description>
		</item>
		<item>
			<title>joni8a on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137822</link>
			<pubDate>Tue, 03 Jan 2012 21:16:07 +0000</pubDate>
			<dc:creator>joni8a</dc:creator>
			<guid isPermaLink="false">137822@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I am sry, posted the wrong code this should help:</p>
<pre><code>self.isTouchEnabled = YES;
        [[CCDirector sharedDirector].openGLView setMultipleTouchEnabled:YES];</code></pre>
<p>A little tip, I would create a rect around each button button like this:<br />
<pre><code>CGRect rightButtonRect;
rightButtonRect = [rightButton boundingBox];</code></pre>
<p>And now check if its touched like this:<br />
<pre><code>-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    UITouch *touch = [touches anyObject];

    CGPoint location = [touch locationInView: [touch view]];
    location = [[CCDirector sharedDirector]convertToGL:location];
    CGRect rect = CGRectMake(location.x, location.y, 1, 1);

    if(CGRectIntersectsRect(rect, rightButtonRect))
    {
        NSLog(@&#34;RIGHT&#34;);

    }

    if(CGRectIntersectsRect(rect, leftButtonRect))
    {
        NSLog(@&#34;LEFT&#34;);

    }

    if(CGRectIntersectsRect(aButtonRect, rect) )
    {
        NSLog(@&#34;JUMP&#34;);

    }
}</code></pre>
<p>Thats just the way I have done it, hope it helps and good luck!!
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137820</link>
			<pubDate>Tue, 03 Jan 2012 20:58:46 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">137820@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thanks a lot!
</p></description>
		</item>
		<item>
			<title>joni8a on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137819</link>
			<pubDate>Tue, 03 Jan 2012 20:56:27 +0000</pubDate>
			<dc:creator>joni8a</dc:creator>
			<guid isPermaLink="false">137819@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>at the moment i am not at my mac, i will post you an example later tonight or tomorrow.
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137817</link>
			<pubDate>Tue, 03 Jan 2012 20:50:41 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">137817@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>I have setMultipleTouchEnabled:Yes and it does not help. I fixed the issue that the touche began Method was first called in the game view by using a standart Delegate for it. But it still does not work. probably I´ll need the multitouch, although this might be the hard way. Do you know an example for it? Or a tutorial or something like that?
</p></description>
		</item>
		<item>
			<title>Birkemose on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137814</link>
			<pubDate>Tue, 03 Jan 2012 20:29:36 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">137814@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>It has been a while since I worked on this. From the top of my head.<br />
You probably still have to setMultipleTouchEnabled:Yes, to overall enable multi touch.<br />
Try putting breakpoints in ccTouchBegan, and change priority in the two layers. You should be able to see which layer is called first.<br />
You have to set swallowsTouches to YES, otherwise returning YES in ccTouchBegan has no effect.
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137808</link>
			<pubDate>Tue, 03 Jan 2012 20:01:05 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">137808@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Ok, I tried the two layers, but it does not work.<br />
The main problem is the touch dispatcher. It calls the touchBegan method of the game layer before it calls the method in the jump Button Layer. And It calls them both. Mo matter if I change the priorities or wich layer is added first to the scene. And still there is only one touch at the same time. Is there any sample code dealing with this?
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137794</link>
			<pubDate>Tue, 03 Jan 2012 18:11:59 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">137794@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Thank you both. I will try Implement the solution from @<a href='http://www.cocos2d-iphone.org/forum/profile/20192'>Birkemose</a>, it sounds very logic and easy. Thank you very much,<br />
Jannes
</p></description>
		</item>
		<item>
			<title>Birkemose on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137791</link>
			<pubDate>Tue, 03 Jan 2012 17:45:01 +0000</pubDate>
			<dc:creator>Birkemose</dc:creator>
			<guid isPermaLink="false">137791@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You either have to implement true multitouch ( a pain in our royal ar*** ), or have at least two objects, responding to touches.<br />
I would suggest ( for a quick starter ), that you add a CCLayer to your scene, and add the jump button to that layer. Give this layer a higher priority ( I think you do that by giving it a lower priority number ), so that it is called first. Check if inside jump button like you do. If not inside jump button, return NO, and the touch handler in next layer ( the game layer ) will be called, and you can handle shoot there.
</p></description>
		</item>
		<item>
			<title>joni8a on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137790</link>
			<pubDate>Tue, 03 Jan 2012 17:43:51 +0000</pubDate>
			<dc:creator>joni8a</dc:creator>
			<guid isPermaLink="false">137790@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Use setMultipleTouchEnabled:Yes for your UIWindow or UIView, and then set the isTouchEnabled property for the layer on which you want to receive touches.
</p></description>
		</item>
		<item>
			<title>Jannes Klaas on "2nd Touch is swallowed"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/28038#post-137789</link>
			<pubDate>Tue, 03 Jan 2012 17:32:11 +0000</pubDate>
			<dc:creator>Jannes Klaas</dc:creator>
			<guid isPermaLink="false">137789@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hello together,<br />
I´m a bit new to Cocos 2d so don´t eat me if this is a stupid question.<br />
I have a simple game where you shoot monsters while jumping over obstacles. I register for touches with this code in the init method of the layer:</p>
<p>self.isTouchEnabled = YES;<br />
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO];</p>
<p>and this is my method to handle touches:</p>
<p>-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {<br />
    CGPoint location = [touch locationInView:[touch view]];<br />
    location = [[CCDirector sharedDirector] convertToGL:location];</p>
<p>   // Is the touch on the jump button<br />
    BOOL isInX = location.x &#62;0 &#38;&#38; location.x &#60;_jumpButton.contentSize.width;<br />
    BOOL isInY = location.y &#62;0 &#38;&#38; location.y &#60;_jumpButton.contentSize.height;</p>
<p>    if (isInX &#38;&#38; isInY) {<br />
        [self jump];<br />
        return YES;<br />
    }</p>
<p>    [self shoot:[NSArray arrayWithObjects:[NSNumber numberWithInt:location.x],[NSNumber numberWithInt:location.y], nil]];</p>
<p>    return YES;<br />
}</p>
<p>Everything works fine, as long as you don´t have two fingers on the device at the same time, for example: You press the jump button and shoot but your finger is still at the jump button. There is no shoot. The method is not called. I don´t understand that, because it´s a new touch that began, to the touch began method should be called.<br />
I tried various things like using ccTouchesBegan or ccTouchesEnded, but it did not help. I also tried using a standartDelegate, but then the method was not called at all.</p>
<p>Can you help me? The gamplay is really bad if you only have one finger at a time.<br />
Thanks in advance, Jannes
</p></description>
		</item>
		<item>
			<title>itsjfletch on "Polling Layer for current touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27962#post-137350</link>
			<pubDate>Fri, 30 Dec 2011 16:10:00 +0000</pubDate>
			<dc:creator>itsjfletch</dc:creator>
			<guid isPermaLink="false">137350@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You should be able to have variables keeping track of the NSSet and UIEvent variables when a touch starts or is moved, and another to check if you are touching when the scene is supposed to change. Then create a class method in the next scene that with return the next scene knowing if there is a touch or not,  and if there is, simply call the touches began method with the NSSet and UIEvent you passed to this scene.<br />
It's kind of jumbled in my head right now, and if that didn't make much sense I can PM you a longer version with the code I'm talking about.
</p></description>
		</item>
		<item>
			<title>slembcke on "Polling Layer for current touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27962#post-137346</link>
			<pubDate>Fri, 30 Dec 2011 15:48:05 +0000</pubDate>
			<dc:creator>slembcke</dc:creator>
			<guid isPermaLink="false">137346@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>You can't poll a view in iOS for touches. It only provides event based input. You need to make a separate event delegate that is not a scene so that it will persist across scene changes. Then you can cache the touches that it sends you so they can be polled or whatever.
</p></description>
		</item>
		<item>
			<title>pabloruiz55 on "Polling Layer for current touches"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/27962#post-137322</link>
			<pubDate>Fri, 30 Dec 2011 11:18:05 +0000</pubDate>
			<dc:creator>pabloruiz55</dc:creator>
			<guid isPermaLink="false">137322@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Hi guys, i am having the following problem and i would like to know if you could help me, thanks in advance!</p>
<p>Suppose i am in scene 1, i touch my CCLayer to move the main character around the screen. When the character reaches a certain point we move to scene 2 (by doing a CCDirector replace scene).<br />
Now, being on scene 2, i want to have the character keep moving if the user is still touching the screen.<br />
The problem is that i can't figure out how to do this. Since the player was already touching the screen when we got to scene 2, i won't get a CCTouchedBegan event called.<br />
The solution i am thinking would be to somehow poll the new layer of scene 2 (or who knows what) asking it: "Hey are you being touched? Where exactly?"<br />
Problem is that i don't know if this is even possible. Any clues or other solutions?<br />
Thanks
</p></description>
		</item>
		<item>
			<title>fuzz on "accurate touch value"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24781#post-130835</link>
			<pubDate>Fri, 02 Dec 2011 23:15:47 +0000</pubDate>
			<dc:creator>fuzz</dc:creator>
			<guid isPermaLink="false">130835@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Oh, well i use the distance value to move the world. Right now it's very jerky as it's eather 1 or 0 pixels, but if i for instance divide the<br />
distance by 4 it is much smoother, however to slow of a movement, but if I multiply by 4 it's good speed but insanely jerky.
</p></description>
		</item>
		<item>
			<title>Eko Mirhard on "accurate touch value"</title>
			<link>http://www.cocos2d-iphone.org/forum/topic/24781#post-130678</link>
			<pubDate>Fri, 02 Dec 2011 06:46:55 +0000</pubDate>
			<dc:creator>Eko Mirhard</dc:creator>
			<guid isPermaLink="false">130678@http://www.cocos2d-iphone.org/forum/</guid>
			<description><p>Sorry, but why did you only use the y-value? If what you need is the distance in y-axis, it goes without saying that you will get those values, as the captured touch location will be always integer, despite being stored as float.
</p></description>
		</item>

	</channel>
</rss>

